Skip to content

Commit

Permalink
Merge pull request #3192 from Phergus/isNumberFix3191
Browse files Browse the repository at this point in the history
Is number fix3191
  • Loading branch information
Phergus authored Nov 20, 2021
2 parents 407cc6d + 24caa46 commit dd50ec0
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,13 @@ public Object childEvaluate(
}
}
if (functionName.equalsIgnoreCase("isNumber")) {
if (NumberUtils.isParsable(parameters.get(0).toString())) {
String str = parameters.get(0).toString().trim();
// isParsable() returns false for leading + so stripping
// off the first one. Any extras will return false.
if (str.length() > 1 && str.charAt(0) == '+') {
str = str.substring(1);
}
if (NumberUtils.isParsable(str)) {
return BigDecimal.ONE;
} else {
return BigDecimal.ZERO;
Expand Down

0 comments on commit dd50ec0

Please sign in to comment.