StringUtils.isNumeric("") is true ?
By admin on Mar 26, 2008 in Java, Programming
Apache Commons is one of my favorite Java libraries. This is one of the mistake that I made recently. Guess what the following code will return
System.out.println(StringUtils.isNumeric(""));
The code will return true instead of false as what I expected. I checked the documentation, and it says for isNumeric.
"Checks if the String contains only unicode digits. A decimal point is not a unicode digit and returns false.
null
will return false
. An empty String ("") will return true
."
Post a Comment