diff options
| author | nga <[email protected]> | 2022-02-10 16:48:09 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:48:09 +0300 | 
| commit | 1f553f46fb4f3c5eec631352cdd900a0709016af (patch) | |
| tree | a231fba2c03b440becaea6c86a2702d0bfb0336e /library/cpp/string_utils/indent_text | |
| parent | c4de7efdedc25b49cbea74bd589eecb61b55b60a (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/string_utils/indent_text')
| -rw-r--r-- | library/cpp/string_utils/indent_text/indent_text.cpp | 40 | ||||
| -rw-r--r-- | library/cpp/string_utils/indent_text/indent_text.h | 8 | 
2 files changed, 24 insertions, 24 deletions
| diff --git a/library/cpp/string_utils/indent_text/indent_text.cpp b/library/cpp/string_utils/indent_text/indent_text.cpp index 09a4f6bca84..07fc9d42007 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 7117d6c0ee6..9951073e2a4 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("    ")); | 
