RSS Feed for This PostCurrent Article

StringUtils.isNumeric("") is true ?

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


Trackback URL


RSS Feed for This PostPost a Comment

CAPTCHA Image
Refresh Image
*