summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/StringUtil.cpp8
-rw-r--r--Source/Core/Common/StringUtil.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp
index 1277a18f72..113d7b781a 100644
--- a/Source/Core/Common/StringUtil.cpp
+++ b/Source/Core/Common/StringUtil.cpp
@@ -704,4 +704,12 @@ void ToUpper(std::string* str)
{
std::transform(str->begin(), str->end(), str->begin(), [](char c) { return Common::ToUpper(c); });
}
+
+bool CaseInsensitiveEquals(std::string_view a, std::string_view b)
+{
+ if (a.size() != b.size())
+ return false;
+ return std::equal(a.begin(), a.end(), b.begin(),
+ [](char ca, char cb) { return Common::ToLower(ca) == Common::ToLower(cb); });
+}
} // namespace Common
diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h
index 3ae97e5562..ed08e758dd 100644
--- a/Source/Core/Common/StringUtil.h
+++ b/Source/Core/Common/StringUtil.h
@@ -264,4 +264,5 @@ inline char ToUpper(char ch)
}
void ToLower(std::string* str);
void ToUpper(std::string* str);
+bool CaseInsensitiveEquals(std::string_view a, std::string_view b);
} // namespace Common