diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-03-23 14:50:19 +0300 |
---|---|---|
committer | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-03-23 14:50:19 +0300 |
commit | 4b1318238b1b7544d1156e9525b85f654ba2dc2d (patch) | |
tree | 659373b72d9af6233c5772d9c02a41a4450ce1bb /indexer/feature_impl.cpp | |
parent | 431299e98329b863b2518ed863c918bc0501256d (diff) |
review fixes
Diffstat (limited to 'indexer/feature_impl.cpp')
-rw-r--r-- | indexer/feature_impl.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/indexer/feature_impl.cpp b/indexer/feature_impl.cpp index 04f4d18a7a..a9d54d1d49 100644 --- a/indexer/feature_impl.cpp +++ b/indexer/feature_impl.cpp @@ -27,27 +27,14 @@ bool IsNumber(strings::UniString const & s) bool IsStreetNumber(strings::UniString const & s) { - size_t count = s.size(); - if (count >= 2) + if (s.size() < 2) + return false; + + /// add different localities in future, if it's a problem. + for (auto const & streetEnding : {"st", "nd", "rd", "th"}) { - /// add different localities in future, if it's a problem. - string streetEndings [] = {"st", "nd", "rd", "th"}; - for (size_t i = 0; i < ARRAY_SIZE(streetEndings); ++i) - { - size_t start = count - streetEndings[i].size(); - bool flag = false; - for (size_t j = 0; j < streetEndings[i].size(); ++j) - { - if (streetEndings[i][j] != static_cast<char>(s[start + j])) - { - flag = true; - break; - } - } - if (flag) - return false; - } - return true; + if (strings::EndsWith(strings::ToUtf8(s), streetEnding)) + return true; } return false; } |