MCPcopy Create free account
hub / github.com/devsisters/libquic / IsStringUTF8

Function IsStringUTF8

src/base/strings/string_util.cc:519–531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517#endif
518
519bool IsStringUTF8(const StringPiece& str) {
520 const char *src = str.data();
521 int32_t src_len = static_cast<int32_t>(str.length());
522 int32_t char_index = 0;
523
524 while (char_index < src_len) {
525 int32_t code_point;
526 CBU8_NEXT(src, char_index, src_len, code_point);
527 if (!IsValidCharacter(code_point))
528 return false;
529 }
530 return true;
531}
532
533// Implementation note: Normally this function will be called with a hardcoded
534// constant for the lowercase_ascii parameter. Constructing a StringPiece from

Callers 8

AppendArgMethod · 0.85
StringValueMethod · 0.85
HasKeyMethod · 0.85
SetMethod · 0.85
GetMethod · 0.85
RemoveMethod · 0.85

Calls 3

IsValidCharacterFunction · 0.85
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected