summaryrefslogtreecommitdiff
path: root/Source/Core/Common/StringUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
-rw-r--r--Source/Core/Common/StringUtil.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp
index c44f3fa7b1..14b7ac832b 100644
--- a/Source/Core/Common/StringUtil.cpp
+++ b/Source/Core/Common/StringUtil.cpp
@@ -412,6 +412,12 @@ void StringPopBackIf(std::string* s, char c)
s->pop_back();
}
+size_t StringUTF8CodePointCount(const std::string& str)
+{
+ return str.size() -
+ std::count_if(str.begin(), str.end(), [](char c) -> bool { return (c & 0xC0) == 0x80; });
+}
+
#ifdef _WIN32
std::wstring CPToUTF16(u32 code_page, std::string_view input)