MCPcopy Create free account
hub / github.com/chen3feng/toft / StringRemoveSuffix

Function StringRemoveSuffix

base/string/algorithm.h:72–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72inline std::string StringRemoveSuffix(const StringPiece& str, const StringPiece& suffix)
73{
74 if (StringEndsWith(str, suffix))
75 {
76 return str.substr(0, str.size() - suffix.size()).as_string();
77 }
78 return str.as_string();
79}
80
81inline bool StringRemoveSuffix(std::string* str, const StringPiece& suffix)
82{

Callers 1

TESTFunction · 0.85

Calls 5

StringEndsWithFunction · 0.85
as_stringMethod · 0.80
substrMethod · 0.80
eraseMethod · 0.80
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.68