MCPcopy Create free account
hub / github.com/baidu/tera / TrimString

Function TrimString

src/common/base/string_ext.cc:70–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70std::string TrimString(const std::string& str, const std::string& trim) {
71 std::string::size_type pos = str.find_first_not_of(trim);
72 if (pos == std::string::npos) {
73 return str;
74 }
75 std::string::size_type pos2 = str.find_last_not_of(trim);
76 if (pos2 != std::string::npos) {
77 return str.substr(pos, pos2 - pos + 1);
78 }
79 return str.substr(pos);
80}
81
82bool StringEndsWith(const std::string& str, const std::string& sub_str) {
83 if (str.length() < sub_str.length()) {

Callers 3

ParseOpMethod · 0.50
DebugFlagFileMethod · 0.50
CheckResultMethod · 0.50

Calls

no outgoing calls

Tested by 3

ParseOpMethod · 0.40
DebugFlagFileMethod · 0.40
CheckResultMethod · 0.40