diff options
author | savrus <savrus@yandex-team.ru> | 2022-02-10 16:50:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:48 +0300 |
commit | 2056f5ae3bf6e5a65e9885e0add085c708cca5b8 (patch) | |
tree | 253bee3c01d51bffda855b0fb547d9b755f669b0 /library/cpp/yt/string/string.cpp | |
parent | 445df920f2d83b93084aba764d98163d25598cda (diff) | |
download | ydb-2056f5ae3bf6e5a65e9885e0add085c708cca5b8.tar.gz |
Restoring authorship annotation for <savrus@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yt/string/string.cpp')
-rw-r--r-- | library/cpp/yt/string/string.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp index 7440ac3fdd..886963cd5a 100644 --- a/library/cpp/yt/string/string.cpp +++ b/library/cpp/yt/string/string.cpp @@ -74,33 +74,33 @@ TString TrimLeadingWhitespaces(const TString& str) } TString Trim(const TString& str, const TString& whitespaces) -{ - size_t end = str.size(); - while (end > 0) { - size_t i = end - 1; - bool isWhitespace = false; - for (auto c : whitespaces) { - if (str[i] == c) { - isWhitespace = true; - break; - } - } - if (!isWhitespace) { - break; - } - --end; - } - - if (end == 0) { - return ""; - } - - size_t begin = str.find_first_not_of(whitespaces); +{ + size_t end = str.size(); + while (end > 0) { + size_t i = end - 1; + bool isWhitespace = false; + for (auto c : whitespaces) { + if (str[i] == c) { + isWhitespace = true; + break; + } + } + if (!isWhitespace) { + break; + } + --end; + } + + if (end == 0) { + return ""; + } + + size_t begin = str.find_first_not_of(whitespaces); YT_VERIFY(begin != TString::npos); YT_VERIFY(begin < end); - return str.substr(begin, end - begin); -} - + return str.substr(begin, end - begin); +} + //////////////////////////////////////////////////////////////////////////////// namespace { |