Alex Rivera | Logout

How do I convert a String to Double in Java using a specific locale?

Asked 2009-05-20T14:01:46.017
44

I want to convert some numbers which I got as strings into Doubles, but these numbers are not in US standard locale, but in a different one. How can I do that?

Edit
Report

1 Answer

7

NumberFormat is the way to go, but you should be aware of its peculiarities which crop up when your data is less than 100% correct.

I found the following usefull:

http://www.ibm.com/developerworks/java/library/j-numberformat/index.html

If your input can be trusted then you don't have to worry about it.

answered 2009-05-20T14:17:58.590

Your Answer