Skip to content

Commit

Permalink
Merge pull request #11488 from lioncash/point
Browse files Browse the repository at this point in the history
StringUtil: Make StringUTF8CodePointCount take string_view
  • Loading branch information
AdmiralCurtiss authored Jan 25, 2023
2 parents 9fc959c + 1d03835 commit 6db2171
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/Core/Common/StringUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; });
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/StringUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6db2171

Please sign in to comment.