UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TCString< T > Struct Template Reference

#include <CString.h>

Public Types

typedefCharType
 

Static Public Member Functions

static bool IsPureAnsi (const CharType *Str)
 
static bool IsPureAnsi (const CharType *Str, const SIZE_T StrLen)
 
static bool IsNumeric (const CharType *Str)
 
static UE_FORCEINLINE_HINT CharTypeStrcpy (CharType *Dest, const CharType *Src)
 
static CharTypeStrcpy (CharType *Dest, SIZE_T DestCount, const CharType *Src)
 
static CharTypeStrncpy (CharType *Dest, const CharType *Src, SIZE_T MaxLen)
 
template<SIZE_T DestCount>
static UE_FORCEINLINE_HINT CharTypeStrcpy (CharType(&Dest)[DestCount], const CharType *Src)
 
static UE_FORCEINLINE_HINT CharTypeStrcat (CharType *Dest, const CharType *Src)
 
static CharTypeStrcat (CharType *Dest, SIZE_T DestSize, const CharType *Src)
 
template<SIZE_T DestCount>
static UE_FORCEINLINE_HINT CharTypeStrcat (CharType(&Dest)[DestCount], const CharType *Src)
 
static CharTypeStrncat (CharType *Dest, const CharType *Src, int32 DestSize)
 
static CharTypeStrncatTruncateSrc (CharType *Dest, const CharType *Src, int32 SrcLen)
 
static CharTypeStrncatTruncateDest (CharType *Dest, int32 DestSize, const CharType *Src)
 
static UE_FORCEINLINE_HINT CharTypeStrupr (CharType *Dest, SIZE_T DestCount)
 
template<SIZE_T DestCount>
static UE_FORCEINLINE_HINT CharTypeStrupr (CharType(&Dest)[DestCount])
 
static UE_FORCEINLINE_HINT int32 Strcmp (const CharType *String1, const CharType *String2)
 
static UE_FORCEINLINE_HINT int32 Strncmp (const CharType *String1, const CharType *String2, SIZE_T Count)
 
static UE_FORCEINLINE_HINT int32 Stricmp (const CharType *String1, const CharType *String2)
 
static UE_FORCEINLINE_HINT int32 Strnicmp (const CharType *String1, const CharType *String2, SIZE_T Count)
 
static const CharTypeSpc (int32 NumSpaces)
 
static const CharTypeTab (int32 NumTabs)
 
static const CharTypeStrfind (const CharType *Str, const CharType *Find, bool bSkipQuotedChars=false)
 
static const CharTypeStrifind (const CharType *Str, const CharType *Find, bool bSkipQuotedChars=false)
 
static const CharTypeStrfindDelim (const CharType *Str, const CharType *Find, const CharType *Delim=LITERAL(CharType, " \t,"))
 
static const CharTypeStristr (const CharType *Str, const CharType *Find)
 
static CharTypeStristr (CharType *Str, const CharType *Find)
 
static const CharTypeStrnistr (const CharType *Str, int32 InStrLen, const CharType *Find, int32 FindLen)
 
static CharTypeStrnistr (CharType *Str, int32 InStrLen, const CharType *Find, int32 FindLen)
 
static const CharTypeStrnstr (const CharType *Str, int32 InStrLen, const CharType *Find, int32 FindLen)
 
static CharTypeStrnstr (CharType *Str, int32 InStrLen, const CharType *Find, int32 FindLen)
 
static int32 Strlen (const CharType *String)
 
static UE_FORCEINLINE_HINT int32 Strnlen (const CharType *String, SIZE_T StringSize)
 
static UE_FORCEINLINE_HINT const CharTypeStrstr (const CharType *String, const CharType *Find)
 
static UE_FORCEINLINE_HINT CharTypeStrstr (CharType *String, const CharType *Find)
 
static UE_FORCEINLINE_HINT const CharTypeStrchr (const CharType *String, CharType c)
 
static UE_FORCEINLINE_HINT CharTypeStrchr (CharType *String, CharType c)
 
static UE_FORCEINLINE_HINT const CharTypeStrrchr (const CharType *String, CharType c)
 
static UE_FORCEINLINE_HINT CharTypeStrrchr (CharType *String, CharType c)
 
static UE_FORCEINLINE_HINT const CharTypeStrrstr (const CharType *String, const CharType *Find)
 
static CharTypeStrrstr (CharType *String, const CharType *Find)
 
static int32 Strspn (const CharType *String, const CharType *Mask)
 
static int32 Strcspn (const CharType *String, const CharType *Mask)
 
static UE_FORCEINLINE_HINT int32 Atoi (const CharType *String)
 
static UE_FORCEINLINE_HINT int64 Atoi64 (const CharType *String)
 
static UE_FORCEINLINE_HINT float Atof (const CharType *String)
 
static UE_FORCEINLINE_HINT double Atod (const CharType *String)
 
static bool ToBool (const CharType *String)
 
static UE_FORCEINLINE_HINT int32 Strtoi (const CharType *Start, CharType **End, int32 Base)
 
static UE_FORCEINLINE_HINT int64 Strtoi64 (const CharType *Start, CharType **End, int32 Base)
 
static UE_FORCEINLINE_HINT uint64 Strtoui64 (const CharType *Start, CharType **End, int32 Base)
 
static UE_FORCEINLINE_HINT CharTypeStrtok (CharType *TokenString, const CharType *Delim, CharType **Context)
 
template<typename FmtType , typename... Types>
static int32 Sprintf (CharType *Dest, const FmtType &Fmt, Types... Args)
 
template<typename FmtType , typename... Types>
static int32 Snprintf (CharType *Dest, int32 DestSize, const FmtType &Fmt, Types... Args)
 
static UE_FORCEINLINE_HINT int32 GetVarArgs (CharType *Dest, SIZE_T DestSize, const CharType *&Fmt, va_list ArgPtr)
 

Detailed Description

template<typename T>
struct TCString< T >

Set of basic string utility functions operating on plain C strings. In addition to the wrapped C string API,this struct also contains a set of widely used utility functions that operate on c strings. There is a specialized implementation for ANSICHAR and WIDECHAR strings provided. To access these functionality, the convenience typedefs FCString and FCStringAnsi are provided.

Member Typedef Documentation

◆ CharType

template<typename T >
typedef T TCString< T >::CharType

Member Function Documentation

◆ Atod()

template<typename T >
UE_FORCEINLINE_HINT double TCString< T >::Atod ( const CharType String)
static

atod wrapper

◆ Atof()

template<typename T >
UE_FORCEINLINE_HINT float TCString< T >::Atof ( const CharType String)
static

atof wrapper

◆ Atoi()

template<typename T >
UE_FORCEINLINE_HINT int32 TCString< T >::Atoi ( const CharType String)
static

atoi wrapper

◆ Atoi64()

template<typename T >
UE_FORCEINLINE_HINT int64 TCString< T >::Atoi64 ( const CharType String)
static

atoi64 wrapper

◆ GetVarArgs()

template<typename T >
UE_FORCEINLINE_HINT int32 TCString< T >::GetVarArgs ( CharType Dest,
SIZE_T  DestSize,
const CharType *&  Fmt,
va_list  ArgPtr 
)
static

Helper function to write formatted output using an argument list

Parameters
Dest- destination string buffer
DestSize- size of destination buffer
Fmt- string to print
Args- argument list
Returns
number of characters written or -1 if truncated

◆ IsNumeric()

template<typename T >
static bool TCString< T >::IsNumeric ( const CharType Str)
inlinestatic

Returns whether this string contains only numeric characters

Parameters
Str- string that will be checked

◆ IsPureAnsi() [1/2]

template<typename T >
static bool TCString< T >::IsPureAnsi ( const CharType Str)
inlinestatic

Returns whether this string contains only pure ansi characters

Parameters
Str- string that will be checked

◆ IsPureAnsi() [2/2]

template<typename T >
static bool TCString< T >::IsPureAnsi ( const CharType Str,
const SIZE_T  StrLen 
)
inlinestatic

◆ Snprintf()

template<typename T >
template<typename FmtType , typename... Types>
static int32 TCString< T >::Snprintf ( CharType Dest,
int32  DestSize,
const FmtType Fmt,
Types...  Args 
)
inlinestatic

Safe string formatted print.

◆ Spc()

template<typename T >
const TCString< T >::CharType * TCString< T >::Spc ( int32  NumSpaces)
static

Returns a static string that is filled with a variable number of spaces

Parameters
NumSpacesNumber of spaces to put into the string, max of 255
Returns
The string of NumSpaces spaces.

◆ Sprintf()

template<typename T >
template<typename FmtType , typename... Types>
static int32 TCString< T >::Sprintf ( CharType Dest,
const FmtType Fmt,
Types...  Args 
)
inlinestatic

Standard string formatted print.

Warning
: make sure code using FCString::Sprintf allocates enough (>= MAX_SPRINTF) memory for the destination buffer

◆ Strcat() [1/3]

template<typename T >
UE_FORCEINLINE_HINT TCString< T >::CharType * TCString< T >::Strcat ( CharType Dest,
const CharType Src 
)
static

strcat wrapper

Parameters
Dest- destination string to copy to
Destcount- size of Dest in characters
Src- source string
Returns
destination string

◆ Strcat() [2/3]

template<typename T >
TCString< T >::CharType * TCString< T >::Strcat ( CharType Dest,
SIZE_T  DestSize,
const CharType Src 
)
inlinestatic

◆ Strcat() [3/3]

template<typename T >
template<SIZE_T DestCount>
static UE_FORCEINLINE_HINT CharType * TCString< T >::Strcat ( CharType(&)  Dest[DestCount],
const CharType Src 
)
inlinestatic

strcat wrapper (templated version to automatically handle static destination array case)

Parameters
Dest- destination string to copy to
Src- source string
Returns
destination string

◆ Strchr() [1/2]

template<typename T >
UE_FORCEINLINE_HINT TCString< T >::CharType * TCString< T >::Strchr ( CharType String,
CharType  c 
)
static

◆ Strchr() [2/2]

template<typename T >
UE_FORCEINLINE_HINT const TCString< T >::CharType * TCString< T >::Strchr ( const CharType String,
CharType  c 
)
static

strchr wrapper

◆ Strcmp()

template<typename T >
UE_FORCEINLINE_HINT int32 TCString< T >::Strcmp ( const CharType String1,
const CharType String2 
)
static

strcmp wrapper

◆ Strcpy() [1/3]

template<typename T >
UE_FORCEINLINE_HINT TCString< T >::CharType * TCString< T >::Strcpy ( CharType Dest,
const CharType Src 
)
static

strcpy wrapper

Parameters
Dest- destination string to copy to
Destcount- size of Dest in characters
Src- source string
Returns
destination string

◆ Strcpy() [2/3]

template<typename T >
TCString< T >::CharType * TCString< T >::Strcpy ( CharType Dest,
SIZE_T  DestCount,
const CharType Src 
)
inlinestatic

◆ Strcpy() [3/3]

template<typename T >
template<SIZE_T DestCount>
static UE_FORCEINLINE_HINT CharType * TCString< T >::Strcpy ( CharType(&)  Dest[DestCount],
const CharType Src 
)
inlinestatic

strcpy wrapper (templated version to automatically handle static destination array case)

Parameters
Dest- destination string to copy to
Src- source string
Returns
destination string

◆ Strcspn()

template<typename T >
int32 TCString< T >::Strcspn ( const CharType String,
const CharType Mask 
)
inlinestatic

strcspn wrapper

◆ Strfind()

template<typename T >
const TCString< T >::CharType * TCString< T >::Strfind ( const CharType Str,
const CharType Find,
bool  bSkipQuotedChars = false 
)
static

Find string in string, case sensitive, requires non-alphanumeric lead-in.

◆ StrfindDelim()

template<typename T >
const TCString< T >::CharType * TCString< T >::StrfindDelim ( const CharType Str,
const CharType Find,
const CharType Delim = LITERAL(CharType, " \t,") 
)
static

Finds string in string, case insensitive, requires the string be surrounded by one the specified delimiters, or the start or end of the string.

◆ Stricmp()

template<typename T >
UE_FORCEINLINE_HINT int32 TCString< T >::Stricmp ( const CharType String1,
const CharType String2 
)
static

stricmp wrapper

◆ Strifind()

template<typename T >
const TCString< T >::CharType * TCString< T >::Strifind ( const CharType Str,
const CharType Find,
bool  bSkipQuotedChars = false 
)
static

Find string in string, case insensitive, requires non-alphanumeric lead-in.

◆ Stristr() [1/2]

template<typename T >
static CharType * TCString< T >::Stristr ( CharType Str,
const CharType Find 
)
inlinestatic

Finds string in string, case insensitive (non-const version)

Parameters
StrThe string to look through
FindThe string to find inside Str
Returns
Position in Str if Find was found, otherwise, nullptr. If Find is non-null but empty, returns Str.

◆ Stristr() [2/2]

template<typename T >
const TCString< T >::CharType * TCString< T >::Stristr ( const CharType Str,
const CharType Find 
)
static

Finds string in string, case insensitive

Parameters
StrThe string to look through
FindThe string to find inside Str
Returns
Position in Str if Find was found, otherwise, nullptr. If Find is non-null but empty, returns Str.

Finds string in string, case insensitive

Parameters
StrThe string to look through
FindThe string to find inside Str
Returns
Position in Str if Find was found, otherwise, NULL. If Find is non-null but empty, returns Str.

◆ Strlen()

template<typename T >
UE_NODEBUG int32 TCString< T >::Strlen ( const CharType String)
inlinestatic

strlen wrapper

◆ Strncat()

template<typename T >
static CharType * TCString< T >::Strncat ( CharType Dest,
const CharType Src,
int32  DestSize 
)
inlinestatic

◆ StrncatTruncateDest()

template<typename T >
static CharType * TCString< T >::StrncatTruncateDest ( CharType Dest,
int32  DestSize,
const CharType Src 
)
inlinestatic

Concatenate a string with length checking. Unlike the CRT strncat, the size argument is interpreted as the size of the Dest buffer (which must include space for the null terminator) rather than the max number of Src characters to append.

Parameters
Dest- destination buffer to append to
Src- source buffer to copy from
DestSize- max size of the dest buffer, including null terminator. Max number of non-terminating characters written into Dest is DestSize - 1.
Returns
pointer to resulting string buffer

◆ StrncatTruncateSrc()

template<typename T >
static CharType * TCString< T >::StrncatTruncateSrc ( CharType Dest,
const CharType Src,
int32  SrcLen 
)
inlinestatic

Append at most SrcLen characters from Src to Dest. Append a null terminator after the last character from Src. This version matches the behavior of CRT strncat: the size given is the maximum number to append from the Src str. If you instead want to specify the length of the destination buffer, call StrncatTruncateDest.

Parameters
Dest- destination buffer to append to
Src- source buffer to copy from
SrcLen- maximum number of characters to copy from Src. If Src length is less than SrcLen, all characters up to the null terminator, and the null terminator, will be copied into Dest.
Returns
pointer to resulting string buffer

◆ Strncmp()

template<typename T >
UE_FORCEINLINE_HINT int32 TCString< T >::Strncmp ( const CharType String1,
const CharType String2,
SIZE_T  Count 
)
static

strncmp wrapper

◆ Strncpy()

template<typename T >
TCString< T >::CharType * TCString< T >::Strncpy ( CharType Dest,
const CharType Src,
SIZE_T  MaxLen 
)
inlinestatic

Copy a string with length checking. Behavior differs from strncpy in that last character is zeroed.

Parameters
Dest- destination buffer to copy to
Src- source buffer to copy from
MaxLen- max length of the buffer (including null-terminator)
Returns
pointer to resulting string buffer

◆ Strnicmp()

template<typename T >
UE_FORCEINLINE_HINT int32 TCString< T >::Strnicmp ( const CharType String1,
const CharType String2,
SIZE_T  Count 
)
static

strnicmp wrapper

◆ Strnistr() [1/2]

template<typename T >
static CharType * TCString< T >::Strnistr ( CharType Str,
int32  InStrLen,
const CharType Find,
int32  FindLen 
)
inlinestatic

Finds string in string, case insensitive (non-const version)

Parameters
StrThe character array to look through
InStrLenThe length of the Str array
FindThe character array to find inside Str
FindLenThe length of the Find array
Returns
Position in Str if Find was found, otherwise, nullptr. If FindLen is 0, returns Str.

◆ Strnistr() [2/2]

template<typename T >
const TCString< T >::CharType * TCString< T >::Strnistr ( const CharType Str,
int32  InStrLen,
const CharType Find,
int32  FindLen 
)
static

Finds string in string, case insensitive

Parameters
StrThe character array to look through
InStrLenThe length of the Str array
FindThe character array to find inside Str
FindLenThe length of the Find array
Returns
Position in Str if Find was found, otherwise, nullptr. If FindLen is 0, returns Str.

◆ Strnlen()

template<typename T >
UE_FORCEINLINE_HINT int32 TCString< T >::Strnlen ( const CharType String,
SIZE_T  StringSize 
)
static

Calculate the length of the string up to the given size.

Parameters
StringA possibly-null-terminated string in a character array with a size of at least StringSize.
StringSizeThe maximum number of characters to read from String.
Returns
Length The smaller of StringSize and the number of characters in String before a null character.

◆ Strnstr() [1/2]

template<typename T >
static CharType * TCString< T >::Strnstr ( CharType Str,
int32  InStrLen,
const CharType Find,
int32  FindLen 
)
inlinestatic

Finds string in string, case sensitive (non-const version)

Parameters
StrThe character array to look through
InStrLenThe length of the Str array
FindThe character array to find inside Str
FindLenThe length of the Find array
Returns
Position in Str if Find was found, otherwise, nullptr. If FindLen is 0, returns Str.

◆ Strnstr() [2/2]

template<typename T >
const TCString< T >::CharType * TCString< T >::Strnstr ( const CharType Str,
int32  InStrLen,
const CharType Find,
int32  FindLen 
)
static

Finds string in string, case sensitive

Parameters
StrThe character array to look through
InStrLenThe length of the Str array
FindThe character array to find inside Str
FindLenThe length of the Find array
Returns
Position in Str if Find was found, otherwise, nullptr. If FindLen is 0, returns Str.

◆ Strrchr() [1/2]

template<typename T >
UE_FORCEINLINE_HINT TCString< T >::CharType * TCString< T >::Strrchr ( CharType String,
CharType  c 
)
static

◆ Strrchr() [2/2]

template<typename T >
UE_FORCEINLINE_HINT const TCString< T >::CharType * TCString< T >::Strrchr ( const CharType String,
CharType  c 
)
static

strrchr wrapper

◆ Strrstr() [1/2]

template<typename T >
TCString< T >::CharType * TCString< T >::Strrstr ( CharType String,
const CharType Find 
)
inlinestatic

◆ Strrstr() [2/2]

template<typename T >
UE_FORCEINLINE_HINT const TCString< T >::CharType * TCString< T >::Strrstr ( const CharType String,
const CharType Find 
)
static

strrstr wrapper

◆ Strspn()

template<typename T >
int32 TCString< T >::Strspn ( const CharType String,
const CharType Mask 
)
inlinestatic

strspn wrapper

◆ Strstr() [1/2]

template<typename T >
UE_FORCEINLINE_HINT TCString< T >::CharType * TCString< T >::Strstr ( CharType String,
const CharType Find 
)
static

◆ Strstr() [2/2]

template<typename T >
UE_FORCEINLINE_HINT const TCString< T >::CharType * TCString< T >::Strstr ( const CharType String,
const CharType Find 
)
static

strstr wrapper

◆ Strtoi()

template<typename T >
UE_FORCEINLINE_HINT int32 TCString< T >::Strtoi ( const CharType Start,
CharType **  End,
int32  Base 
)
static

strtoi wrapper

◆ Strtoi64()

template<typename T >
UE_FORCEINLINE_HINT int64 TCString< T >::Strtoi64 ( const CharType Start,
CharType **  End,
int32  Base 
)
static

strtoi wrapper

◆ Strtok()

template<typename T >
UE_FORCEINLINE_HINT TCString< T >::CharType * TCString< T >::Strtok ( CharType TokenString,
const CharType Delim,
CharType **  Context 
)
static

strtok wrapper

◆ Strtoui64()

template<typename T >
UE_FORCEINLINE_HINT uint64 TCString< T >::Strtoui64 ( const CharType Start,
CharType **  End,
int32  Base 
)
static

strtoui wrapper

◆ Strupr() [1/2]

template<typename T >
UE_FORCEINLINE_HINT TCString< T >::CharType * TCString< T >::Strupr ( CharType Dest,
SIZE_T  DestCount 
)
static

strupr wrapper

Parameters
Dest- destination string to convert
Destcount- size of Dest in characters
Returns
destination string

◆ Strupr() [2/2]

template<typename T >
template<SIZE_T DestCount>
static UE_FORCEINLINE_HINT CharType * TCString< T >::Strupr ( CharType(&)  Dest[DestCount])
inlinestatic

strupr wrapper (templated version to automatically handle static destination array case)

Parameters
Dest- destination string to convert
Returns
destination string

◆ Tab()

template<typename T >
const TCString< T >::CharType * TCString< T >::Tab ( int32  NumTabs)
static

Returns a static string that is filled with a variable number of tabs

Parameters
NumTabsNumber of tabs to put into the string, max of 255
Returns
The string of NumTabs tabs.

◆ ToBool()

template<typename T >
static bool TCString< T >::ToBool ( const CharType String)
inlinestatic

Converts a string into a boolean value 1, "True", "Yes", FCoreTexts::True, FCoreTexts::Yes, and non-zero integers become true 0, "False", "No", FCoreTexts::False, FCoreTexts::No, and unparsable values become false

Returns
The boolean value

The documentation for this struct was generated from the following files: