diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 0419fcc288..2a696f32f8 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -669,3 +669,16 @@ std::string GetEscapedHtml(std::string html) } return html; } + +namespace Common +{ +void ToLower(std::string* str) +{ + std::transform(str->begin(), str->end(), str->begin(), [](char c) { return Common::ToLower(c); }); +} + +void ToUpper(std::string* str) +{ + std::transform(str->begin(), str->end(), str->begin(), [](char c) { return Common::ToUpper(c); }); +} +} // namespace Common diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h index d91bc41df3..f008dc55bb 100644 --- a/Source/Core/Common/StringUtil.h +++ b/Source/Core/Common/StringUtil.h @@ -240,3 +240,17 @@ std::vector CommandLineToUtf8Argv(const wchar_t* command_line); #endif std::string GetEscapedHtml(std::string html); + +namespace Common +{ +inline char ToLower(char ch) +{ + return std::tolower(ch, std::locale::classic()); +} +inline char ToUpper(char ch) +{ + return std::toupper(ch, std::locale::classic()); +} +void ToLower(std::string* str); +void ToUpper(std::string* str); +} // namespace Common