MCPcopy Create free account
hub / github.com/apache/brpc / DoIsStringASCII

Function DoIsStringASCII

src/butil/strings/string_util.cc:345–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343
344template<class STR>
345static bool DoIsStringASCII(const STR& str) {
346 for (size_t i = 0; i < str.length(); i++) {
347 typename ToUnsigned<typename STR::value_type>::Unsigned c = str[i];
348 if (c > 0x7F)
349 return false;
350 }
351 return true;
352}
353
354bool IsStringASCII(const StringPiece& str) {
355 return DoIsStringASCII(str);

Callers 1

IsStringASCIIFunction · 0.85

Calls 1

lengthMethod · 0.45

Tested by

no test coverage detected