java NumberFormat为某些地区的货币显示错误的十进制标记格式
对于某些地区,如es CO,我认为货币的numberformat十进制标记不正确:
NumberFormat numberFormat =
NumberFormat.getCurrencyInstance(new Locale("es", "CO"));
numberFormat.setCurrency(Currency.getInstance("COP"));
String currencyString = numberFormat.format(164900.12);
System.out.println(currencyString);
对于这一点,我得到的结果是164.900,21,而当我签入像:http://www.xe.com/currencyconverter/convert这样的站点时 我从另一个方向得到它,即164900.21 这是NumberFormat类的问题还是我做错了什么
# 1 楼答案
请检查Locale类的构造函数,它首先排除语言,然后排除国家代码
像这样更改代码,您将得到这样的输出“COP 164900.12”