summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2022-01-16 16:23:12 -0800
committerPokechu22 <Pokechu022@gmail.com>2022-01-16 16:56:53 -0800
commitaaec64501abae397235865f0d8ddafb036e10811 (patch)
tree03120c92afe817ca62f155fc1df65c5deec7b458 /Source/Core/Common
parente62771856092cd9bbc25c8c94c433ed0e55a9f3f (diff)
Create Common::ToLower and Common::ToUpper
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/StringUtil.cpp13
-rw-r--r--Source/Core/Common/StringUtil.h14
2 files changed, 27 insertions, 0 deletions
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<std::string> 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