| 8 | namespace osm_element |
| 9 | { |
| 10 | uint64_t GetPopulation(std::string const & str) |
| 11 | { |
| 12 | std::string number; |
| 13 | for (auto const c : str) |
| 14 | if (isdigit(c)) |
| 15 | number += c; |
| 16 | else if (c == '.' || c == ',' || c == ' ') |
| 17 | continue; |
| 18 | else |
| 19 | break; |
| 20 | |
| 21 | if (number.empty()) |
| 22 | return 0; |
| 23 | |
| 24 | uint64_t result = 0; |
| 25 | if (!strings::to_uint64(number, result)) |
| 26 | LOG(LWARNING, ("Failed to get population from", number, str)); |
| 27 | |
| 28 | return result; |
| 29 | } |
| 30 | |
| 31 | uint64_t GetPopulation(OsmElement const & elem) |
| 32 | { |