aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/string_utils
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commit1f553f46fb4f3c5eec631352cdd900a0709016af (patch)
treea231fba2c03b440becaea6c86a2702d0bfb0336e /library/cpp/string_utils
parentc4de7efdedc25b49cbea74bd589eecb61b55b60a (diff)
downloadydb-1f553f46fb4f3c5eec631352cdd900a0709016af.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/string_utils')
-rw-r--r--library/cpp/string_utils/indent_text/indent_text.cpp40
-rw-r--r--library/cpp/string_utils/indent_text/indent_text.h8
-rw-r--r--library/cpp/string_utils/url/url_ut.cpp16
3 files changed, 32 insertions, 32 deletions
diff --git a/library/cpp/string_utils/indent_text/indent_text.cpp b/library/cpp/string_utils/indent_text/indent_text.cpp
index 09a4f6bca8..07fc9d4200 100644
--- a/library/cpp/string_utils/indent_text/indent_text.cpp
+++ b/library/cpp/string_utils/indent_text/indent_text.cpp
@@ -1,25 +1,25 @@
#include "indent_text.h"
-#include <util/stream/str.h>
-
+#include <util/stream/str.h>
+
TString IndentText(TStringBuf text, TStringBuf indent) {
- if (text.empty())
+ if (text.empty())
return TString();
-
- TStringStream ss;
+
+ TStringStream ss;
ss.Reserve(text.size() + 20);
-
- char pc = 0;
- for (size_t i = 0; i < text.size(); ++i) {
- if (i == 0 || pc == '\n')
- ss << indent;
-
- char c = text.at(i);
- ss << c;
- pc = c;
- }
- if (pc != '\n')
- ss << '\n';
-
- return ss.Str();
-}
+
+ char pc = 0;
+ for (size_t i = 0; i < text.size(); ++i) {
+ if (i == 0 || pc == '\n')
+ ss << indent;
+
+ char c = text.at(i);
+ ss << c;
+ pc = c;
+ }
+ if (pc != '\n')
+ ss << '\n';
+
+ return ss.Str();
+}
diff --git a/library/cpp/string_utils/indent_text/indent_text.h b/library/cpp/string_utils/indent_text/indent_text.h
index 7117d6c0ee..9951073e2a 100644
--- a/library/cpp/string_utils/indent_text/indent_text.h
+++ b/library/cpp/string_utils/indent_text/indent_text.h
@@ -1,6 +1,6 @@
-#pragma once
-
+#pragma once
+
#include <util/generic/string.h>
-#include <util/generic/strbuf.h>
-
+#include <util/generic/strbuf.h>
+
TString IndentText(TStringBuf text, TStringBuf indent = TStringBuf(" "));
diff --git a/library/cpp/string_utils/url/url_ut.cpp b/library/cpp/string_utils/url/url_ut.cpp
index 1588013893..ca0ab74948 100644
--- a/library/cpp/string_utils/url/url_ut.cpp
+++ b/library/cpp/string_utils/url/url_ut.cpp
@@ -3,18 +3,18 @@
#include <util/string/cast.h>
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TUtilUrlTest) {
Y_UNIT_TEST(TestGetHostAndGetHostAndPort) {
- UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru/bebe"));
+ UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru/bebe"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru/bebe"));
- UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru"));
+ UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru"));
- UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru:8080"));
+ UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru:8080"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru:8080", GetHostAndPort("ya.ru:8080"));
- UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru/bebe:8080"));
+ UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru/bebe:8080"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru/bebe:8080"));
- UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru:8080/bebe"));
+ UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru:8080/bebe"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("https://ya.ru:8080/bebe"));
UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("www.ya.ru:8080/bebe"));
UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("https://www.ya.ru:8080/bebe"));
@@ -25,7 +25,7 @@ Y_UNIT_TEST_SUITE(TUtilUrlTest) {
// check simple string
UNIT_ASSERT_VALUES_EQUAL("some_blender_url", GetHost("some_blender_url"));
UNIT_ASSERT_VALUES_EQUAL("", GetHost(""));
- }
+ }
Y_UNIT_TEST(TestGetPathAndQuery) {
UNIT_ASSERT_VALUES_EQUAL("/", GetPathAndQuery("ru.wikipedia.org"));
@@ -278,4 +278,4 @@ Y_UNIT_TEST_SUITE(TUtilUrlTest) {
UNIT_ASSERT_VALUES_EQUAL(false, DoesUrlPathStartWithToken("http://bebe", "bebe"));
UNIT_ASSERT_VALUES_EQUAL(false, DoesUrlPathStartWithToken("https://bebe/", "bebe"));
}
-}
+}