Double.parseDouble() is not Locale specific, how do I get round this?

I am parsing Strings into doubles using
String myNumber = "12,34";
double d = Double.parseDouble( myNumber );The problem is that my number is of French style (it has commas instead of fullstops for the decimal points)
The default Locale is English, so I get NumberFormat problems when parsing. (I can understand this)
I even get NumberFormat problems when I do this:
Locale.setDefault(Locale.FRENCH);
double d = Double.parseDouble( myNumber );Which I think is really strange. I guess the Locale of Double is set at a certain time and not reset.
OR maybe Double.parseDouble( <STRING> ); is not Locale specific?
Where is my understanding wrong?

Do you know if DecimalFormat reflects the default Locale if the default Locale changes?
Or will I have to make a new DecimalFormat whenever it changes?As Locale is invariant, a DecimalFormat instance (as well a any object with a reference to the default Locale) cannot reflect the default Locale changes.
But each time you create a new instance of DecimalFormat without specifying the Locale, it will get up-to-date Locale.
However, you might prefer setting the locale explicitely (instead of changing the default one.)
Note that Double valueOf() or parseDouble() methods are not related to default Locale, they use a fixed format.

Similar Messages

Maybe you are looking for

  • Open purhchase orders

    Hi all, i have a requirement to extract all open purchase order data from sap to FTP like matnr, ekko-ebeln, ekko-aedat, lifnr, sprat, open quantity. please i would really appreciate your assistance. Regards Reddy

  • Jbuilder 6 of 7 and windows 98 sec edition

    i have jbuilder 6 or 7 and i like it to install it on windows98 platform. The installation is not impossibel. Pleas,can sombody help me. Sorry for my Englisch, I am a dutch boy who learnig Java and Englisch IVO tx

  • OPEN WITH right click crazyness

    Ok, the open with menu shows like 3+ versions of the APP.

  • Color Format in calssical Report

    hi experts, I want in tne output of the report suppose first record(whole row, not only the characters) will b displayed in one particular color second row in some other color and like wise alternate roes have same color in classical report. Ravi

  • Importing High Res. JPG with RAW?

    Is there any reason to import JPG images with RAW images? I sometimes shoot high res. JPG with RAW just so I have some high res. JPGs for temporary use immediately after a shoot and for archival purposes, but I can't think of a reason to import JPGs