| 2358 | } |
| 2359 | |
| 2360 | bool String::is_numeric() const { |
| 2361 | if (length() == 0) { |
| 2362 | return false; |
| 2363 | } |
| 2364 | |
| 2365 | int s = 0; |
| 2366 | if (operator[](0) == '-') { |
| 2367 | ++s; |
| 2368 | } |
| 2369 | bool dot = false; |
| 2370 | for (int i = s; i < length(); i++) { |
| 2371 | char32_t c = operator[](i); |
| 2372 | if (c == '.') { |
| 2373 | if (dot) { |
| 2374 | return false; |
| 2375 | } |
| 2376 | dot = true; |
| 2377 | } else if (!is_digit(c)) { |
| 2378 | return false; |
| 2379 | } |
| 2380 | } |
| 2381 | |
| 2382 | return true; /// @todo Use the parser below for this instead |
| 2383 | } |
| 2384 | |
| 2385 | template <typename C> |
| 2386 | static double built_in_strtod( |
no test coverage detected