2

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?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Victor
  • 16,609
  • 71
  • 229
  • 409

3 Answers3

4

Jumping on the bandwagon...

enter image description here

mre
  • 43,520
  • 33
  • 120
  • 170
2

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.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
2

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"

RMT
  • 7,040
  • 4
  • 25
  • 37