Merge pull request #11488 from lioncash/point

StringUtil: Make StringUTF8CodePointCount take string_view
This commit is contained in:
Admiral H. Curtiss 2023-01-25 02:33:22 +01:00 committed by GitHub
commit 6db2171fd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -437,7 +437,7 @@ void StringPopBackIf(std::string* s, char c)
s->pop_back();
}
size_t StringUTF8CodePointCount(const std::string& str)
size_t StringUTF8CodePointCount(std::string_view str)
{
return str.size() -
std::count_if(str.begin(), str.end(), [](char c) -> bool { return (c & 0xC0) == 0x80; });

View File

@ -170,7 +170,7 @@ std::string WithUnifiedPathSeparators(std::string path);
std::string PathToFileName(std::string_view path);
void StringPopBackIf(std::string* s, char c);
size_t StringUTF8CodePointCount(const std::string& str);
size_t StringUTF8CodePointCount(std::string_view str);
std::string CP1252ToUTF8(std::string_view str);
std::string SHIFTJISToUTF8(std::string_view str);