commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (JIRA)" <>
Subject [jira] [Resolved] (LANG-1016) NumberUtils#isParsable method(s)
Date Wed, 09 Jul 2014 19:25:07 GMT


Benedikt Ritter resolved LANG-1016.

       Resolution: Fixed
    Fix Version/s:     (was: Discussion)
                       (was: Review Patch)

bene@localhost:~/workspace/apache/commons/lang$ svn ci -m "LANG-1016: NumberUtils#isParsable
method(s). Thanks to Juan Pablo Santos Rodríguez."
Sending        src/changes/changes.xml
Sending        src/main/java/org/apache/commons/lang3/math/
Sending        src/test/java/org/apache/commons/lang3/math/
Transmitting file data ...
Committed revision 1609273.

I've changed the method name from {{isParseable}} to {{isParsable}} because according to
this is preferred in formal usage.


> NumberUtils#isParsable method(s)
> --------------------------------
>                 Key: LANG-1016
>                 URL:
>             Project: Commons Lang
>          Issue Type: Wish
>          Components: lang.math.*
>            Reporter: Juan Pablo Santos Rodríguez
>            Assignee: Benedikt Ritter
>             Fix For: 3.4
>         Attachments: LANG-1016.patch
> (for background see [LANG-997|])
> It would be nice to have an {{isParseable}} method (or whatever it may be called), to
be able to identify valid (=parseable) Numbers, something along the lines {{toDouble(String)}}
/ {{toLong(String)}} etc., but returning {{true}} / {{false}} while avoiding at the same time
the {{try/catch(NumberFormatException)}} of those methods.
> This method would be similar to {{isNumber}}, but it should yield {{true}} for invalid
octals like "018" which are parseable as Numbers. The point of this method is to identify
"human" (neither hex nor octal, but should handle decimal points) numbers stored as Strings,

> We are using NumberUtils#isNumber to identify valid (parseable, human) numbers, but as
of 3.3, this method also handles octal numbers, so, f.ex.,  018, which was recognized as a
valid number, isn't recognized anymore as one.

This message was sent by Atlassian JIRA

View raw message