37 #include "../../Platforms/Basic/interface/DebugUtilities.hpp"
44 std::string NarrowStr;
46 const std::ctype<wchar_t>& ctfacet = std::use_facet<std::ctype<wchar_t>>(std::wstringstream().getloc());
47 for (std::wstring::const_iterator CurrWChar = WideStr.begin();
48 CurrWChar != WideStr.end();
50 NarrowStr.push_back(ctfacet.narrow(*CurrWChar, 0));
57 std::string NarrowStr;
59 const std::ctype<wchar_t>& ctfacet = std::use_facet<std::ctype<wchar_t>>(std::wstringstream().getloc());
60 for (
auto CurrWChar = WideStr; *CurrWChar != 0; ++CurrWChar)
61 NarrowStr.push_back(ctfacet.narrow(*CurrWChar, 0));
70 const std::ctype<wchar_t>& ctfacet = std::use_facet<std::ctype<wchar_t>>(std::wstringstream().getloc());
71 for (
auto CurrChar = Str; *CurrChar != 0; ++CurrChar)
72 WideStr.push_back(ctfacet.widen(*CurrChar));
81 const std::ctype<wchar_t>& ctfacet = std::use_facet<std::ctype<wchar_t>>(std::wstringstream().getloc());
82 for (std::string::const_iterator CurrChar = Str.begin();
83 CurrChar != Str.end();
85 WideStr.push_back(ctfacet.widen(*CurrChar));
90 inline int StrCmpNoCase(
const char* Str1,
const char* Str2,
size_t NumChars)
92 #if PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS
93 # define _strnicmp strncasecmp
96 return _strnicmp(Str1, Str2, NumChars);
101 #if PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS
102 # define _stricmp strcasecmp
105 return _stricmp(Str1, Str2);
110 inline bool StreqSuff(
const char* RefStr,
const char* Str,
const char* Suff,
bool NoSuffixAllowed =
false)
113 if (RefStr ==
nullptr)
116 const auto* r = RefStr;
121 for (; *r != 0 && *s != 0; ++r, ++s)
146 if (NoSuffixAllowed && *r == 0)
159 return strcmp(r, Suff) == 0;
173 std::transform(str.begin(), str.end(), str.begin(),
175 [](
unsigned char c) { return static_cast<char>(std::tolower(c)); });
186 return c >=
'0' && c <=
'9';
196 const auto* num_end = str;
201 if (*c ==
'+' || *c ==
'-')
207 if (*c ==
'0' &&
IsNum(*(c + 1)))
218 if (c != str &&
IsNum(c[-1]))
228 if (*c ==
'e' || *c ==
'E')
230 if (c - str < 2 || !
IsNum(c[-2]))
233 return num_end - str;
237 else if (*c ==
'e' || *c ==
'E')
239 if (c - str < 1 || !
IsNum(c[-1]))
242 return num_end - str;
246 if (*c ==
'e' || *c ==
'E')
249 if (*c !=
'+' && *c !=
'-')
250 return num_end - str;
257 return num_end - str;