开发者

How to convert a formatted string to float in java with different locales?

开发者 https://www.devze.com 2023-03-13 22:44 出处:网络
I have a number with string type e.g. \"1,000.00\" in (EN) and the same value \"1 000,00\" i开发者_高级运维n (FR).

I have a number with string type e.g. "1,000.00" in (EN) and the same value "1 000,00" i开发者_高级运维n (FR).

how can I convert this string to float (e.g. 1000.00).

is there a method to do this in java or do I have to implement a getFloat(str,locale) my self.

Thanks


DecimalFormat will do it. Read this tutorial for details.

0

精彩评论

暂无评论...
验证码 换一张
取 消