diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /util/string/subst.h | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string/subst.h')
-rw-r--r-- | util/string/subst.h | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/util/string/subst.h b/util/string/subst.h index 45b622fbef..32a2789801 100644 --- a/util/string/subst.h +++ b/util/string/subst.h @@ -1,44 +1,44 @@ #pragma once -#include <util/generic/fwd.h> +#include <util/generic/fwd.h> -#include <stlfwd> +#include <stlfwd> -/* Replace all occurences of substring `what` with string `with` starting from position `from`. - * - * @param text String to modify. - * @param what Substring to replace. - * @param with Substring to use as replacement. - * @param from Position at with to start replacement. - * - * @return Number of replacements occured. - */ -size_t SubstGlobal(TString& text, TStringBuf what, TStringBuf with, size_t from = 0); -size_t SubstGlobal(std::string& text, TStringBuf what, TStringBuf with, size_t from = 0); -size_t SubstGlobal(TUtf16String& text, TWtringBuf what, TWtringBuf with, size_t from = 0); -size_t SubstGlobal(std::u16string& text, TWtringBuf what, TWtringBuf with, size_t from = 0); +/* Replace all occurences of substring `what` with string `with` starting from position `from`. + * + * @param text String to modify. + * @param what Substring to replace. + * @param with Substring to use as replacement. + * @param from Position at with to start replacement. + * + * @return Number of replacements occured. + */ +size_t SubstGlobal(TString& text, TStringBuf what, TStringBuf with, size_t from = 0); +size_t SubstGlobal(std::string& text, TStringBuf what, TStringBuf with, size_t from = 0); +size_t SubstGlobal(TUtf16String& text, TWtringBuf what, TWtringBuf with, size_t from = 0); +size_t SubstGlobal(std::u16string& text, TWtringBuf what, TWtringBuf with, size_t from = 0); size_t SubstGlobal(TUtf32String& text, TUtf32StringBuf what, TUtf32StringBuf with, size_t from = 0); -/* Replace all occurences of character `what` with character `with` starting from position `from`. - * - * @param text String to modify. - * @param what Character to replace. - * @param with Character to use as replacement. - * @param from Position at with to start replacement. - * - * @return Number of replacements occured. - */ -size_t SubstGlobal(TString& text, char what, char with, size_t from = 0); -size_t SubstGlobal(std::string& text, char what, char with, size_t from = 0); -size_t SubstGlobal(TUtf16String& text, wchar16 what, wchar16 with, size_t from = 0); -size_t SubstGlobal(std::u16string& text, wchar16 what, wchar16 with, size_t from = 0); +/* Replace all occurences of character `what` with character `with` starting from position `from`. + * + * @param text String to modify. + * @param what Character to replace. + * @param with Character to use as replacement. + * @param from Position at with to start replacement. + * + * @return Number of replacements occured. + */ +size_t SubstGlobal(TString& text, char what, char with, size_t from = 0); +size_t SubstGlobal(std::string& text, char what, char with, size_t from = 0); +size_t SubstGlobal(TUtf16String& text, wchar16 what, wchar16 with, size_t from = 0); +size_t SubstGlobal(std::u16string& text, wchar16 what, wchar16 with, size_t from = 0); size_t SubstGlobal(TUtf32String& text, wchar32 what, wchar32 with, size_t from = 0); -// TODO(yazevnul): -// - rename `SubstGlobal` to `ReplaceAll` for convenience +// TODO(yazevnul): +// - rename `SubstGlobal` to `ReplaceAll` for convenience // - add `SubstGlobalCopy(TStringBuf)` for convenience -// - add `RemoveAll(text, what, from)` as a shortcut for `SubstGlobal(text, what, "", from)` -// - rename file to `replace.h` +// - add `RemoveAll(text, what, from)` as a shortcut for `SubstGlobal(text, what, "", from)` +// - rename file to `replace.h` /* Replace all occurences of substring or character `what` with string or character `with` starting from position `from`, and return result string. * |