15#define MAX_SPRINTF 1024
69 if constexpr (std::is_same_v<CharType, ANSICHAR>)
73 else if constexpr (std::is_same_v<CharType, WIDECHAR>)
84 else if constexpr (std::is_same_v<CharType, UTF8CHAR>)
88 if ((
uint8)*Str > 0x7f)
97 static_assert(
sizeof(
CharType) == 0,
"Not supported");
103 if constexpr (std::is_same_v<CharType, ANSICHAR>)
107 else if constexpr (std::is_same_v<CharType, WIDECHAR>)
109 for (
SIZE_T Idx = 0; Idx < StrLen; Idx++, Str++)
118 else if constexpr (std::is_same_v<CharType, UTF8CHAR>)
120 for (
SIZE_T Idx = 0; Idx < StrLen; Idx++, Str++)
122 if ((
uint8)*Str > 0x7f)
131 static_assert(
sizeof(
CharType) == 0,
"Not supported");
141 if (*Str ==
'-' || *Str ==
'+')
180 UE_DEPRECATED(5.6,
"Use Strncpy instead. Note that Strncpy has a behavior difference from Strcpy: it memzeroes the entire DestCount-sized buffer after the end of string.")
204 return Strncpy( Dest, Src, DestCount);
255 if (SrcLen <= 0 || !*Src)
297 }
while (*Src && Len + 1 <
DestSize);
319 template<SIZE_T DestCount>
322 return Strupr( Dest, DestCount );
517 if constexpr (std::is_same_v<CharType, ANSICHAR>)
521 else if constexpr (std::is_same_v<CharType, WIDECHAR>)
525 else if constexpr (std::is_same_v<CharType, UTF8CHAR>)
531 static_assert(
sizeof(
CharType) == 0,
"Not supported");
560 template <
typename SrcEncoding>
568 template <
typename FmtType,
typename... Types>
574 return SprintfImpl(Dest, (
const CharType*)
Fmt, Args...);
580 template <
typename FmtType,
typename... Types>
610template <
typename CharType = TCHAR>
805 if(
Find ==
nullptr || Str ==
nullptr )
905 constexpr uint64 SignBit =
sizeof(
CharType) == 1 ? 0x80ull : 0x8000ull;
907 constexpr uint64 Ones64 =
sizeof(
CharType) == 1 ? 0x0101010101010101ull : 0x0001000100010001ull;
979 return FPlatformString::Strcpy(Dest, Src);
982template <
typename T>
inline
986 return FPlatformString::Strcpy(Dest, DestCount, Src);
990template <
typename T>
inline
993 FPlatformString::Strncpy(Dest, Src,
MaxLen);
1000 return FPlatformString::Strcat(Dest, Src);
1003template <
typename T>
inline
1007 return FPlatformString::Strcat(Dest, DestCount, Src);
1014 return FPlatformString::Strupr(Dest, DestCount);
1046template <
typename T>
1049 if constexpr (std::is_same_v<T, UTF32CHAR>)
1055 return FPlatformString::Strlen(
String);
1068 return FPlatformString::Strstr(
String,
Find);
1080 return FPlatformString::Strchr(
String, c);
1092 return FPlatformString::Strrchr(
String, c);
1107template <
typename T>
inline
1129template <
typename T>
inline
1152template <
typename T>
inline
1175 return FPlatformString::Atoi(
String);
1181 return FPlatformString::Atoi64(
String);
1187 return FPlatformString::Atof(
String);
1193 return FPlatformString::Atod(
String);
1199 return FPlatformString::Strtoi(Start,
End,
Base);
1205 return FPlatformString::Strtoi64(Start,
End,
Base);
1211 return FPlatformString::Strtoui64(Start,
End,
Base);
1227template <
typename T>
1230 static_assert(std::is_same_v<CharType, ANSICHAR> || std::is_same_v<CharType, WIDECHAR> || std::is_same_v<CharType, UTF8CHAR>,
"Not supported");
1237template <
typename T>
1240 static_assert(std::is_same_v<CharType, ANSICHAR> || std::is_same_v<CharType, WIDECHAR> || std::is_same_v<CharType, UTF8CHAR>,
"Not supported");
#define NULL
Definition oodle2base.h:134
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define MAX_SPRINTF
Definition CString.h:15
TCString< ANSICHAR > FCStringAnsi
Definition CString.h:602
TCString< WIDECHAR > FCStringWide
Definition CString.h:603
TCString< TCHAR > FCString
Definition CString.h:601
TCString< UTF8CHAR > FCStringUtf8
Definition CString.h:604
ENGINE_API void StringSize(const UFont *Font, int32 &XL, int32 &YL, FStringView Text)
Definition Canvas.cpp:1181
#define LITERAL(CharType, StringLiteral)
Definition Char.h:31
#define UE_PTRDIFF_TO_INT32(argument)
Definition CoreMiscDefines.h:442
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define GET_TYPED_VARARGS_RESULT(CharType, msg, msgsize, len, lastarg, fmt, result)
Definition VarArgs.h:29
Type
Definition CString.h:21
@ IgnoreCase
Definition CString.h:26
@ CaseSensitive
Definition CString.h:23
Type
Definition CString.h:34
@ FromEnd
Definition CString.h:39
@ FromStart
Definition CString.h:36
implementation
Definition PlayInEditorLoadingScope.h:8
CORE_API int32 Strlen32(const UTF32CHAR *String)
Definition CString.cpp:187
UE_STRING_CLASS Result(Forward< LhsType >(Lhs), RhsLen)
Definition String.cpp.inl:732
static CORE_API bool FromCStringWide(const WIDECHAR *String)
Definition CString.cpp:123
static CORE_API bool FromCStringAnsi(const ANSICHAR *String)
Definition CString.cpp:114
static CORE_API bool FromCStringUtf8(const UTF8CHAR *String)
Definition CString.cpp:155
static CORE_API const CharType SpcArray[MAX_SPACES+1]
Definition CString.h:619
static constexpr int32 MAX_TABS
Definition CString.h:617
static CORE_API const CharType TabArray[MAX_TABS+1]
Definition CString.h:620
static constexpr int32 MAX_SPACES
Definition CString.h:614
static UE_FORCEINLINE_HINT CharType * Strtok(CharType *TokenString, const CharType *Delim, CharType **Context)
Definition CString.h:1216
static UE_FORCEINLINE_HINT int32 Strnlen(const CharType *String, SIZE_T StringSize)
Definition CString.h:1060
static UE_FORCEINLINE_HINT int32 Atoi(const CharType *String)
Definition CString.h:1173
static int32 Snprintf(CharType *Dest, int32 DestSize, const FmtType &Fmt, Types... Args)
Definition CString.h:581
static int32 Strspn(const CharType *String, const CharType *Mask)
Definition CString.h:1130
static CharType * Strnistr(CharType *Str, int32 InStrLen, const CharType *Find, int32 FindLen)
Definition CString.h:413
static UE_FORCEINLINE_HINT int32 Strcmp(const CharType *String1, const CharType *String2)
Definition CString.h:1018
static CharType * Stristr(CharType *Str, const CharType *Find)
Definition CString.h:393
static bool IsPureAnsi(const CharType *Str, const SIZE_T StrLen)
Definition CString.h:101
static UE_FORCEINLINE_HINT int32 Stricmp(const CharType *String1, const CharType *String2)
Definition CString.h:1030
static UE_FORCEINLINE_HINT int32 Strtoi(const CharType *Start, CharType **End, int32 Base)
Definition CString.h:1197
static UE_FORCEINLINE_HINT float Atof(const CharType *String)
Definition CString.h:1185
static int32 Strlen(const CharType *String)
Definition CString.h:1047
static const CharType * Tab(int32 NumTabs)
Definition CString.h:631
static UE_FORCEINLINE_HINT int32 Strncmp(const CharType *String1, const CharType *String2, SIZE_T Count)
Definition CString.h:1024
static CharType * StrncatTruncateDest(CharType *Dest, int32 DestSize, const CharType *Src)
Definition CString.h:281
static UE_FORCEINLINE_HINT double Atod(const CharType *String)
Definition CString.h:1191
static CharType * Strncpy(CharType *Dest, const CharType *Src, SIZE_T MaxLen)
Definition CString.h:991
static UE_FORCEINLINE_HINT CharType * Strcpy(CharType *Dest, const CharType *Src)
Definition CString.h:977
static UE_FORCEINLINE_HINT const CharType * Strrstr(const CharType *String, const CharType *Find)
Definition CString.h:1102
static const CharType * Strnistr(const CharType *Str, int32 InStrLen, const CharType *Find, int32 FindLen)
Definition CString.h:841
static UE_FORCEINLINE_HINT const CharType * Strchr(const CharType *String, CharType c)
Definition CString.h:1078
static UE_FORCEINLINE_HINT int32 GetVarArgs(CharType *Dest, SIZE_T DestSize, const CharType *&Fmt, va_list ArgPtr)
Definition CString.h:1222
static UE_FORCEINLINE_HINT CharType * Strupr(CharType(&Dest)[DestCount])
Definition CString.h:320
static UE_FORCEINLINE_HINT int64 Atoi64(const CharType *String)
Definition CString.h:1179
static UE_FORCEINLINE_HINT int32 Strnicmp(const CharType *String1, const CharType *String2, SIZE_T Count)
Definition CString.h:1036
static const CharType * Strfind(const CharType *Str, const CharType *Find, bool bSkipQuotedChars=false)
Definition CString.h:641
static UE_FORCEINLINE_HINT CharType * Strcat(CharType *Dest, const CharType *Src)
Definition CString.h:998
static bool IsPureAnsi(const CharType *Str)
Definition CString.h:67
static const CharType * Strifind(const CharType *Str, const CharType *Find, bool bSkipQuotedChars=false)
Definition CString.h:692
static CharType * Strncat(CharType *Dest, const CharType *Src, int32 DestSize)
Definition CString.h:237
static bool ToBool(const CharType *String)
Definition CString.h:515
static int32 Strcspn(const CharType *String, const CharType *Mask)
Definition CString.h:1153
static bool IsNumeric(const CharType *Str)
Definition CString.h:139
static UE_FORCEINLINE_HINT uint64 Strtoui64(const CharType *Start, CharType **End, int32 Base)
Definition CString.h:1209
T CharType
Definition CString.h:61
static UE_FORCEINLINE_HINT CharType * Strupr(CharType *Dest, SIZE_T DestCount)
Definition CString.h:1012
static const CharType * Spc(int32 NumSpaces)
Definition CString.h:624
static CharType * StrncatTruncateSrc(CharType *Dest, const CharType *Src, int32 SrcLen)
Definition CString.h:253
static const CharType * Stristr(const CharType *Str, const CharType *Find)
Definition CString.h:799
static const CharType * Strnstr(const CharType *Str, int32 InStrLen, const CharType *Find, int32 FindLen)
Definition CString.h:881
static CharType * Strnstr(CharType *Str, int32 InStrLen, const CharType *Find, int32 FindLen)
Definition CString.h:436
static UE_FORCEINLINE_HINT const CharType * Strrchr(const CharType *String, CharType c)
Definition CString.h:1090
static const CharType * StrfindDelim(const CharType *Str, const CharType *Find, const CharType *Delim=LITERAL(CharType, " \t,"))
Definition CString.h:751
static UE_FORCEINLINE_HINT int64 Strtoi64(const CharType *Start, CharType **End, int32 Base)
Definition CString.h:1203
static int32 Sprintf(CharType *Dest, const FmtType &Fmt, Types... Args)
Definition CString.h:569
static UE_FORCEINLINE_HINT const CharType * Strstr(const CharType *String, const CharType *Find)
Definition CString.h:1066
static bool IsDigit(CharType Char)
Definition Char.h:240
static CharType ToUpper(CharType Char)
Definition Char.h:80
Definition IsArrayOrRefOfTypeByPredicate.h:13
Definition IsCharEncodingCompatibleWith.h:65
Definition IsValidVariadicFunctionArg.h:14