Force point (“.”) as decimal separator in java

后端 未结 7 733
一向
一向 2020-11-29 05:04

I currently use the following code to print a double:

return String.format(\"%.2f\", someDouble);

This works well, except that Java uses my

相关标签:
7条回答
  • 2020-11-29 05:41

    You can use NumberFormat and DecimalFormat.

    Take a look at this link from Java Tutorials LocaleSpecific Formatting

    The section titled Locale-Sensitive Formatting is what you need.

    0 讨论(0)
提交回复
热议问题