aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/string/string.cpp
diff options
context:
space:
mode:
authorsavrus <savrus@yandex-team.ru>2022-02-10 16:50:48 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:48 +0300
commit2056f5ae3bf6e5a65e9885e0add085c708cca5b8 (patch)
tree253bee3c01d51bffda855b0fb547d9b755f669b0 /library/cpp/yt/string/string.cpp
parent445df920f2d83b93084aba764d98163d25598cda (diff)
downloadydb-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.cpp50
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 {