summaryrefslogtreecommitdiff
path: root/Source/Core/Common/StringUtil.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2024-09-26 18:24:36 -0400
committerGitHub <noreply@github.com>2024-09-26 18:24:36 -0400
commitb1cd4a6690241f2372fc7ef1471e4e23f1366ac1 (patch)
tree239ac4e42d0cd99c6d0344ded7bb7decc55ac69b /Source/Core/Common/StringUtil.cpp
parentd4d3acb79637b683fcd2ce52f420200fb70b87c9 (diff)
parent508ccc2054590a9efa89054e742b74521f272063 (diff)
Merge pull request #13068 from mitaclaw/redundant-case-insensitive
IniFile: Migrate `Common::CaseInsensitiveLess` to StringUtil
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
-rw-r--r--Source/Core/Common/StringUtil.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp
index 7fc4af83b6..508ba8baf8 100644
--- a/Source/Core/Common/StringUtil.cpp
+++ b/Source/Core/Common/StringUtil.cpp
@@ -666,10 +666,14 @@ void ToUpper(std::string* str)
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); });
+ return std::ranges::equal(
+ a, b, [](char ca, char cb) { return Common::ToLower(ca) == Common::ToLower(cb); });
+}
+
+bool CaseInsensitiveLess::operator()(std::string_view a, std::string_view b) const
+{
+ return std::ranges::lexicographical_compare(
+ a, b, [](char ca, char cb) { return Common::ToLower(ca) < Common::ToLower(cb); });
}
std::string BytesToHexString(std::span<const u8> bytes)