NumberFormatException maybe yes maybe no

Discussion in 'Java' started by LeoPelo, Mar 26, 2009.

  1. LeoPelo

    LeoPelo New Member

    Joined:
    Mar 26, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice