You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Juan Pablo Santos Rodríguez (JIRA)" <ji...@apache.org> on 2014/07/11 17:02:04 UTC

[jira] [Reopened] (LANG-1016) NumberUtils#isParsable method(s)

     [ https://issues.apache.org/jira/browse/LANG-1016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juan Pablo Santos Rodríguez reopened LANG-1016:
-----------------------------------------------


Hi Benedikt,

I've just realized that the provided patch doesn't handle negative values, allowed by Double.parseDouble( String str ). I'm attaching a patch fixing this issue in a moment

br,

> NumberUtils#isParsable method(s)
> --------------------------------
>
>                 Key: LANG-1016
>                 URL: https://issues.apache.org/jira/browse/LANG-1016
>             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|https://issues.apache.org/jira/browse/LANG-997?focusedCommentId=13991193&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13991193])
> 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
(v6.2#6252)