我想使用DecimalFormat類格式化一個雙數。使用DecimalFormat格式化雙數
我希望這是基於Locale打印。
代碼:
DecimalFormat df = new DecimalFormat("#####,###,###.00");
String result = df.format(99999999999.99);
System.out.println(result);
實際輸出:
99,999,999,999.99
預期輸出:
99999,999,999.99
的[DecimalFormat的可變的組大小(http://stackoverflow.com/questions/10229716/decimalformat-variable-group-size)可能的複製 – azurefrog
@azurefrog:我們能否使用'String.format'對於這個用例呢? – Shankar