diff options
author | Yuri Gorshenin <y@maps.me> | 2016-04-20 15:46:11 +0300 |
---|---|---|
committer | Yuri Gorshenin <y@maps.me> | 2016-04-22 17:32:49 +0300 |
commit | f48c3e6a6a55501908279b73c39089ca0e04f01e (patch) | |
tree | 90b735c24256bf483e72ffd967f91cbad25f1704 /base | |
parent | ca9a3693b9c246c88881173f3b0cd56ee26fc0b5 (diff) |
[search] Postcodes are added to the search index.
Diffstat (limited to 'base')
-rw-r--r-- | base/string_utils.cpp | 4 | ||||
-rw-r--r-- | base/string_utils.hpp | 15 |
2 files changed, 19 insertions, 0 deletions
diff --git a/base/string_utils.cpp b/base/string_utils.cpp index 5f26059688..da13ecb282 100644 --- a/base/string_utils.cpp +++ b/base/string_utils.cpp @@ -220,6 +220,10 @@ bool IsASCIIString(string const & str) return true; } +bool IsASCIIDigit(UniChar c) { return c >= '0' && c <= '9'; } + +bool IsASCIILatin(UniChar c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } + bool StartsWith(UniString const & s, UniString const & p) { if (p.size() > s.size()) diff --git a/base/string_utils.hpp b/base/string_utils.hpp index 1c4634646a..f7c5b775ff 100644 --- a/base/string_utils.hpp +++ b/base/string_utils.hpp @@ -29,6 +29,19 @@ public: template <class IterT> UniString(IterT b, IterT e) : BaseT(b, e) {} bool IsEqualAscii(char const * s) const; + + UniString & operator+=(UniString const & rhs) + { + append(rhs); + return *this; + } + + UniString operator+(UniString const & rhs) const + { + UniString result(*this); + result += rhs; + return result; + } }; /// Performs full case folding for string to make it search-compatible according @@ -67,6 +80,8 @@ bool EqualNoCase(string const & s1, string const & s2); UniString MakeUniString(string const & utf8s); string ToUtf8(UniString const & s); bool IsASCIIString(string const & str); +bool IsASCIIDigit(UniChar c); +bool IsASCIILatin(UniChar c); inline string DebugPrint(UniString const & s) { |