1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-21 00:19:29 +02:00

count unicode chars to extra function

This commit is contained in:
Michael
2023-08-24 18:34:00 +02:00
committed by GitHub
parent e6f1677d3a
commit 37e2292720
3 changed files with 10 additions and 2 deletions

View File

@ -193,6 +193,12 @@ void TextOperations::trimRightUnicode(std::string & text, const size_t amount)
}
}
size_t getUnicodeCharactersCount(const std::string & text)
{
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv;
return conv.from_bytes(text).size();
}
std::string TextOperations::escapeString(std::string input)
{
boost::replace_all(input, "\\", "\\\\");