Java: StringUtils.isNumeric with Decimal Point
By admin on Sep 1, 2008 in Java, Programming
For the code snippet
1: System.out.println(StringUtils.isNumeric("10.0"));
Using Apache Commons Lang, the above will return false. This is one bug I recently found in one of the existing application.
As quoted from the documentation, StringUtils.isNumeric
Checks if the String contains only unicode digits. A decimal point is not a unicode digit and returns false.
To return the correct result, you should use NumberUtils.isNumber
Sorry, comments for this entry are closed at this time.