开发者

Java number format - #.## - Windows and Linux

I'm using following code to format Double number

De开发者_如何学运维cimalFormat decimalFormat=new DecimalFormat("#.##");
decimalFormat.format(1.04)

but this gives

java.lang.NumberFormatException: For input string: "1,04"

in Linux - but in Windows 7 this works fine, how to correct this?


There seems to be a very similar question answered here ( DecimalFormat and Double.valueOf() ) about the java number format. Basically the diference you are experiencing may be related to the Locale Settings defined on Windows being different to the Linux one (for example: on Windows you configured it to a contry/language different then the linux one).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜