我有一个 Double:5096,54 我需要将其格式化为:5.096,54(欧洲货币格式) 我正在尝试使用此代码但没有任何成功。
Locale l = Locale.getDefault(); // ("fr" in my case)
// Get the formatter for the specific locale
NumberFormat formatter = NumberFormat.getNumberInstance(l);
// Always 2 decimals
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
// Format
return formatter.format(d);
输出:5 096,54 当我期待 5.096,54 知道为什么会失败吗?