javastringapache-commons-lang

Is StringUtils.isNumeric() method specification logically correct?


Apache's StringUtils.isNumeric() method specification says:
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.

Is this logically right? Why do they see empty string as numeric?


Solution

  • There was not only me who asked this question :) People were opening this defect in Apache's Jira: https://issues.apache.org/jira/browse/LANG-428

    They closed without fixing it only to keep backwards compatibility (to follow method specification).

    But everybody agreed that current behavior of method is wrong.