MCPcopy Create free account
hub / github.com/catboost/catboost / Trim

Function Trim

library/cpp/yt/string/string.cpp:74–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74[[nodiscard]] TStringBuf Trim(TStringBuf str Y_LIFETIME_BOUND, TStringBuf whitespaces)
75{
76 if (whitespaces.empty()) {
77 return str;
78 }
79 auto end = str.find_last_not_of(whitespaces);
80
81 if (end == TStringBuf::npos) {
82 return "";
83 }
84
85 auto begin = str.find_first_not_of(whitespaces);
86 YT_VERIFY(begin != TStringBuf::npos);
87 return str.substr(begin, end - begin + 1);
88}
89
90////////////////////////////////////////////////////////////////////////////////
91

Callers 1

TESTFunction · 0.50

Calls 4

emptyMethod · 0.45
find_last_not_ofMethod · 0.45
find_first_not_ofMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected