diff options
| author | Techjar <tecknojar@gmail.com> | 2018-11-21 00:15:44 -0500 |
|---|---|---|
| committer | Techjar <tecknojar@gmail.com> | 2020-07-16 19:03:54 -0400 |
| commit | 037aa2192fa9b3de481e2acf125180bab16d6084 (patch) | |
| tree | cab94df1c18e50476928036cdd8d1190602e2525 /Source/Core/Common/StringUtil.cpp | |
| parent | 92812d0b0b1a78febc34d3e5fbb551e50ad77eb9 (diff) | |
NetPlay: Limit nickname length
Ridiculously long nicknames cause UI silliness, so 30 characters seems
like a reasonable limit, as it's the same as the forum.
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) |
