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 | 2ee4b26133812e990e7958fc1863d8d5f8ee7f7b (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/yt/string/string.cpp | |
parent | 2056f5ae3bf6e5a65e9885e0add085c708cca5b8 (diff) | |
download | ydb-2ee4b26133812e990e7958fc1863d8d5f8ee7f7b.tar.gz |
Restoring authorship annotation for <savrus@yandex-team.ru>. Commit 2 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 886963cd5a..7440ac3fdd 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 { |