Search code examples
javaapache-commons-lang

Numeric validation in Commons Lang


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?


Solution

  • 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.