MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / is_numeric

Method is_numeric

core/string/ustring.cpp:2360–2383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2358}
2359
2360bool 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
2385template <typename C>
2386static double built_in_strtod(

Calls 1

is_digitFunction · 0.85

Tested by

no test coverage detected