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

后端 未结 7 966
一向
一向 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:18

    I had the same issue.. 55.1 transformed to 55,10. My quick (dirty?) fix is :

    String.format("%.2f", value).replaceAll(",",".");

提交回复
热议问题