From f3e7096029d090b57fc6c818f541c02834642cc4 Mon Sep 17 00:00:00 2001 From: babenko Date: Sun, 28 Jun 2026 19:27:41 +0300 Subject: YT-22593: Add AsciiStringToLower/AsciiStringToUpper commit_hash:106e53bffa668818abf8e4003d694e1eb0a0316f --- library/cpp/yt/string/string.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'library/cpp/yt/string/string.cpp') diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp index 1da50b4ccdd..e4a2afeca5e 100644 --- a/library/cpp/yt/string/string.cpp +++ b/library/cpp/yt/string/string.cpp @@ -65,6 +65,26 @@ TString CamelCaseToUnderscoreCase(TStringBuf str) //////////////////////////////////////////////////////////////////////////////// +std::string AsciiStringToLower(TStringBuf value) +{ + std::string result(value.size(), '\0'); + for (size_t index = 0; index < value.size(); ++index) { + result[index] = ::AsciiToLower(value[index]); + } + return result; +} + +std::string AsciiStringToUpper(TStringBuf value) +{ + std::string result(value.size(), '\0'); + for (size_t index = 0; index < value.size(); ++index) { + result[index] = ::AsciiToUpper(value[index]); + } + return result; +} + +//////////////////////////////////////////////////////////////////////////////// + [[nodiscard]] TStringBuf TrimLeadingWhitespaces(TStringBuf str Y_LIFETIME_BOUND) { auto begin = str.find_first_not_of(' '); @@ -292,7 +312,7 @@ size_t TCaseInsensitiveStringHasher::operator()(TStringBuf arg) const { auto compute = [&] (char* buffer) { for (size_t index = 0; index < arg.length(); ++index) { - buffer[index] = AsciiToLower(arg[index]); + buffer[index] = ::AsciiToLower(arg[index]); } return ComputeHash(TStringBuf(buffer, arg.length())); }; -- cgit v1.3