diff options
author | tobo <tobo@yandex-team.ru> | 2022-02-10 16:47:27 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:27 +0300 |
commit | 55a7f90e4cd31e9481cace8ee5dfd682c27e810e (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /util/string/type.cpp | |
parent | 7fe839092527589b38f014d854c51565b3c1adfa (diff) | |
download | ydb-55a7f90e4cd31e9481cace8ee5dfd682c27e810e.tar.gz |
Restoring authorship annotation for <tobo@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/string/type.cpp')
-rw-r--r-- | util/string/type.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/util/string/type.cpp b/util/string/type.cpp index 3fbc547fc6..49671c02c2 100644 --- a/util/string/type.cpp +++ b/util/string/type.cpp @@ -17,38 +17,38 @@ bool IsSpace(const char* s, size_t len) noexcept { template <typename TStringType> static bool IsNumberT(const TStringType& s) noexcept { - if (s.empty()) { - return false; - } - + if (s.empty()) { + return false; + } + return std::all_of(s.begin(), s.end(), IsAsciiDigit<typename TStringType::value_type>); -} - +} + bool IsNumber(const TStringBuf s) noexcept { - return IsNumberT(s); -} - + return IsNumberT(s); +} + bool IsNumber(const TWtringBuf s) noexcept { - return IsNumberT(s); -} - + return IsNumberT(s); +} + template <typename TStringType> static bool IsHexNumberT(const TStringType& s) noexcept { - if (s.empty()) { + if (s.empty()) { return false; - } + } return std::all_of(s.begin(), s.end(), IsAsciiHex<typename TStringType::value_type>); } bool IsHexNumber(const TStringBuf s) noexcept { - return IsHexNumberT(s); -} - + return IsHexNumberT(s); +} + bool IsHexNumber(const TWtringBuf s) noexcept { - return IsHexNumberT(s); -} - + return IsHexNumberT(s); +} + namespace { template <size_t N> bool IsCaseInsensitiveAnyOf(TStringBuf str, const std::array<TStringBuf, N>& options) { @@ -63,24 +63,24 @@ namespace { bool IsTrue(const TStringBuf v) noexcept { static constexpr std::array<TStringBuf, 7> trueOptions{ - "true", - "t", - "yes", - "y", - "on", - "1", - "da"}; + "true", + "t", + "yes", + "y", + "on", + "1", + "da"}; return IsCaseInsensitiveAnyOf(v, trueOptions); } bool IsFalse(const TStringBuf v) noexcept { static constexpr std::array<TStringBuf, 7> falseOptions{ - "false", - "f", - "no", - "n", - "off", - "0", - "net"}; + "false", + "f", + "no", + "n", + "off", + "0", + "net"}; return IsCaseInsensitiveAnyOf(v, falseOptions); } |