commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stevo Slavic (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LANG-674) NumberUtils and decimal point character
Date Sun, 27 Oct 2013 12:57:34 GMT

    [ https://issues.apache.org/jira/browse/LANG-674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12988629#comment-12988629
] 

Stevo Slavic edited comment on LANG-674 at 10/27/13 12:57 PM:
--------------------------------------------------------------

With plain Java I can parse String number representations with either dot or comma as decimal
point character depending on locale, but not with commons-lang 2.6 lang.math API. See java.text.NumberFormat,
java.text.DecimalFormatSymbols.decimalSeparator.

E.g.

NumberFormat.getNumberInstance(Locale.US).parse(sPrice)

will properly handle price string with dot as decimal point character for US locale while

NumberFormat.getNumberInstance(new Locale("nl")).parse(sPrice);

will properly handle price string with comma as decimal point character for Dutch locale.



was (Author: sslavic):
With plain Java I can parse String number representations with either dot or comma as decimal
point character depending on locale, but not with commons-lang 2.6 lang.math API. See java.text.NumberFormat,
java.text.DecimalFormatSymbols.decimalSeparator.

E.g.

NumberFormat.getNumberInstance(Locale.US).parse(sPrice)

will properly handle price string with dot as decimal point character for US locale while

NumberFormat.getNumberInstance(new Locale("nl")).parse(sPrice);

will properly handle price string with command as decimal point character for Dutch locale.


> NumberUtils and decimal point character
> ---------------------------------------
>
>                 Key: LANG-674
>                 URL: https://issues.apache.org/jira/browse/LANG-674
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.math.*
>            Reporter: Henri Yandell
>             Fix For: Patch Needed
>
>
> Stevo Slavić reports on commons-user:
> Is there any valid reason why '.' is hardcoded as decimal point
> character in lang.math.NumberUtils, commons-lang (2.6) ? Shouldn't
> this be locale dependent?



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message