Reputation: 17107
While using the org.apache.commons.lang.math.NumberUtils.isNumber(String str)
function, I see that passing a string like "1f"
passes validation while passing "1a"
fails.
What kind of alphabets are allowed here?
Upvotes: 2
Views: 778
Reputation: 7070
the 1f
is taking the 1 as a float.
"1a"
won't be considered as a hexadecimal value because it needs the 0x
in front of it,
ex: "0x1a
"
Upvotes: 2
Reputation: 692231
From the documentation:
Valid numbers include hexadecimal marked with the
0x
qualifier, scientific notation and numbers marked with a type qualifier (e.g. 123L).
1f
means the float number 1.
Upvotes: 2