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

Function EndsWithT

src/butil/strings/string_util.cc:459–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457
458template <typename STR>
459bool EndsWithT(const STR& str, const STR& search, bool case_sensitive) {
460 size_t str_length = str.length();
461 size_t search_length = search.length();
462 if (search_length > str_length)
463 return false;
464 if (case_sensitive)
465 return str.compare(str_length - search_length, search_length, search) == 0;
466 return std::equal(search.begin(), search.end(),
467 str.begin() + (str_length - search_length),
468 butil::CaseInsensitiveCompare<typename STR::value_type>());
469}
470
471bool EndsWith(const std::string& str, const std::string& search,
472 bool case_sensitive) {

Callers 1

EndsWithFunction · 0.85

Calls 4

compareMethod · 0.80
lengthMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected