I was trying to format a number by putting points to make reading easier.
Only with the dot does not work, but it works with commas.
Ex:
String s = String.format("%. d", 123456);
System.out.println(s);
I was trying to format a number by putting points to make reading easier.
Only with the dot does not work, but it works with commas.
Ex:
String s = String.format("%. d", 123456);
System.out.println(s);
%, d is the thousands separator, and will use the default location of the JVM unless you specify otherwise. To force the Brazilian location that uses dot as separator, unlike the American that uses comma you can:
String.format(new Locale("pt"),"%,d",1234567)