Skip to content

Commit

Permalink
Merge pull request #2350 from fayer3/const-float-parsing
Browse files Browse the repository at this point in the history
fix const float parsing
  • Loading branch information
IMS212 committed Jun 13, 2024
2 parents 00d26a3 + 5d0cc61 commit ef1131c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,18 @@ public String takeNumber() {
if (!Character.isDigit(text.charAt(position)) && !Character.isDigit(text.charAt(position + 1))) {
break;
}
} else if (!Character.isDigit(text.charAt(position))) {
break;
}

position++;
}

// take any f float suffixes, if we have a number
if (position > 0 && position + 1 < text.length() && (text.charAt(position) == 'f' || text.charAt(position) == 'F')) {
position++;
}

try {
Float.parseFloat(text.substring(0, position));
} catch (Exception e) {
Expand Down

0 comments on commit ef1131c

Please sign in to comment.