mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 22:25:38 +00:00
Added a StringUtil function to return the string length in Unicode characters
This commit is contained in:
parent
428bbc1416
commit
3b5d5a7da4
|
@ -470,6 +470,19 @@ namespace Utils
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t unicodeLength(const std::string& stringArg)
|
||||||
|
{
|
||||||
|
size_t length {0};
|
||||||
|
size_t charLength {0};
|
||||||
|
|
||||||
|
for (size_t i {0}; i < stringArg.length(); i += charLength) {
|
||||||
|
charLength = moveCursor(stringArg, i, 1) - i;
|
||||||
|
++length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
std::string toLower(const std::string& stringArg)
|
std::string toLower(const std::string& stringArg)
|
||||||
{
|
{
|
||||||
std::string stringLower;
|
std::string stringLower;
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace Utils
|
||||||
size_t nextCursor(const std::string& stringArg, const size_t cursor);
|
size_t nextCursor(const std::string& stringArg, const size_t cursor);
|
||||||
size_t prevCursor(const std::string& stringArg, const size_t cursor);
|
size_t prevCursor(const std::string& stringArg, const size_t cursor);
|
||||||
size_t moveCursor(const std::string& stringArg, const size_t cursor, const int amount);
|
size_t moveCursor(const std::string& stringArg, const size_t cursor, const int amount);
|
||||||
|
size_t unicodeLength(const std::string& stringArg);
|
||||||
std::string toLower(const std::string& stringArg);
|
std::string toLower(const std::string& stringArg);
|
||||||
std::string toUpper(const std::string& stringArg);
|
std::string toUpper(const std::string& stringArg);
|
||||||
std::string toCapitalized(const std::string& stringArg);
|
std::string toCapitalized(const std::string& stringArg);
|
||||||
|
|
Loading…
Reference in a new issue