I want to add the thousands separator to a variable of type double
. I have tried using String.format("%,f", x);
and similar, but it seems to have a fixed number of decimal places, unlike Double.toString()
.
For example, with the value 1234.5:
Double.toString()
: 1234.5
String.format()
: 1.234,500000
Desired: 1.234,5