views:

142

answers:

1

In .Net when handling numbers with unspecified locale I use:

return double.Parse(myStr, CultureInfo.InvariantCulture.NumberFormat);

Whats the equivalent in Java? java.util.Locale doesnt seem to include such a thing.

A: 

Well, you can use NumberFormat.getNumberInstance().parse();

Riduidel
Doesnt that return an instance of the current *default* locale of the virtual machine?
mizipzor
Yes, obviously, but it is to my mind the closest thing to what you ask, since there is nothing such as InvariantCulture in Java (which I may suspect to have an underlying bias).
Riduidel