You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Fix is_valid_float, Variant parser, Expression parser, script highlighter, and TextServer not handing capital E in scientific notation.
This commit is contained in:
@@ -4964,17 +4964,18 @@ bool String::is_valid_float() const {
|
||||
bool numbers_found = false;
|
||||
|
||||
for (int i = from; i < len; i++) {
|
||||
if (is_digit(operator[](i))) {
|
||||
const char32_t c = operator[](i);
|
||||
if (is_digit(c)) {
|
||||
if (exponent_found) {
|
||||
exponent_values_found = true;
|
||||
} else {
|
||||
numbers_found = true;
|
||||
}
|
||||
} else if (numbers_found && !exponent_found && operator[](i) == 'e') {
|
||||
} else if (numbers_found && !exponent_found && (c == 'e' || c == 'E')) {
|
||||
exponent_found = true;
|
||||
} else if (!period_found && !exponent_found && operator[](i) == '.') {
|
||||
} else if (!period_found && !exponent_found && c == '.') {
|
||||
period_found = true;
|
||||
} else if ((operator[](i) == '-' || operator[](i) == '+') && exponent_found && !exponent_values_found && !sign_found) {
|
||||
} else if ((c == '-' || c == '+') && exponent_found && !exponent_values_found && !sign_found) {
|
||||
sign_found = true;
|
||||
} else {
|
||||
return false; // no start with number plz
|
||||
|
||||
Reference in New Issue
Block a user