diff options
| author | JosJuice <josjuice@gmail.com> | 2024-10-15 17:08:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-15 17:08:55 +0200 |
| commit | 07605bf67c6815510688ebf3e71583624c3bfab0 (patch) | |
| tree | 45d3c7260daf088cbf44febda937f1a4c34c5141 /Source/Core/Common/StringUtil.cpp | |
| parent | ef8b753cd778179e1c2980b1ec2615f80a314714 (diff) | |
| parent | e572081ac322253d65bf767a88887fedd4e97c2e (diff) | |
Merge pull request #13090 from mitaclaw/ranges-modernization-1-trivial
Ranges Algorithms Modernization - Trivial
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
| -rw-r--r-- | Source/Core/Common/StringUtil.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 508ba8baf8..935db75d2f 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -234,8 +234,8 @@ std::string_view StripQuotes(std::string_view s) // Turns "\n\rhello" into " hello". void ReplaceBreaksWithSpaces(std::string& str) { - std::replace(str.begin(), str.end(), '\r', ' '); - std::replace(str.begin(), str.end(), '\n', ' '); + std::ranges::replace(str, '\r', ' '); + std::ranges::replace(str, '\n', ' '); } void TruncateToCString(std::string* s) @@ -403,8 +403,7 @@ void StringPopBackIf(std::string* s, char c) size_t StringUTF8CodePointCount(std::string_view str) { - return str.size() - - std::count_if(str.begin(), str.end(), [](char c) -> bool { return (c & 0xC0) == 0x80; }); + return str.size() - std::ranges::count_if(str, [](char c) -> bool { return (c & 0xC0) == 0x80; }); } #ifdef _WIN32 @@ -656,12 +655,12 @@ std::string GetEscapedHtml(std::string html) void ToLower(std::string* str) { - std::transform(str->begin(), str->end(), str->begin(), [](char c) { return Common::ToLower(c); }); + std::ranges::transform(*str, str->begin(), static_cast<char (&)(char)>(Common::ToLower)); } void ToUpper(std::string* str) { - std::transform(str->begin(), str->end(), str->begin(), [](char c) { return Common::ToUpper(c); }); + std::ranges::transform(*str, str->begin(), static_cast<char (&)(char)>(Common::ToUpper)); } bool CaseInsensitiveEquals(std::string_view a, std::string_view b) |
