You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "will mason (JIRA)" <ji...@apache.org> on 2014/09/17 04:57:33 UTC
[jira] [Created] (LANG-1038) NumberUtils#isNumber() returns false
for "+2" and true for "-2"
will mason created LANG-1038:
--------------------------------
Summary: NumberUtils#isNumber() returns false for "+2" and true for "-2"
Key: LANG-1038
URL: https://issues.apache.org/jira/browse/LANG-1038
Project: Commons Lang
Issue Type: Bug
Components: lang.math.*
Affects Versions: 3.3.2, 3.1
Reporter: will mason
The strings:
+2
+ 2
Give a "False" result when tested by isNumber(). Case one, "+2" is legal with Integer.parseint(). Case two: "+ 2" gives an exception with Integer.parseInt().
I believe the function should match legitimate inputs for the respective parser function depending on the number type.
Workaround:
Use something like:
NumberUtils.isNumber( wrkStr.replaceFirst( "\\+", "") )
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)