diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2020-07-16 18:15:19 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-16 18:15:19 -0500 |
| commit | 01178e4fd9b58c24fe02b92d91724c418acbb1eb (patch) | |
| tree | cab94df1c18e50476928036cdd8d1190602e2525 /Source/Core/Common/StringUtil.cpp | |
| parent | c59648337a8e65178d03687ec7bf7349e9bc9ccd (diff) | |
| parent | 037aa2192fa9b3de481e2acf125180bab16d6084 (diff) | |
Merge pull request #7410 from Techjar/netplay-max-name-length
NetPlay: Limit nickname length
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
| -rw-r--r-- | Source/Core/Common/StringUtil.cpp | 6 |
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) |
