Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   NumberFormatException maybe yes maybe no (http://www.go4expert.com/forums/numberformatexception-maybe-yes-maybe-t16675/)

LeoPelo 26Mar2009 13:31

NumberFormatException maybe yes maybe no
 
I have to work on a test machine and when my work is complete and tested, I have to put it online for customers.

On these two machines my code doesn't work in different ways!

This part is the problem:

public void setQntaRiduAsDecimalQuantityString(String qntaRidu) {
try{
Double pippo=new Double(qntaRidu.replace(',','.'));
}
catch(NumberFormatException x)
{...}

On test machine i have String qntaRidu = 42,123 (with comma).
All goes ok and pippo gets 42.123

On "Online" machine the same code, and same value in qntaRidu , cast a NumberFormatException.

In java, is number format customizable ? (for example in Oracle you can localize your machine, so you can choose to have comma as decimal separator instead of dot.)

Thanks for help (i work with oc4j 10.1.3.3)


All times are GMT +5.5. The time now is 01:42.