我收到了瑞典用户的错误报告,说瑞典货币使用了错误的小数点分隔符。在Android中使用错误的小数点分隔符格式化货币
NumberFormat enUS = NumberFormat.getCurrencyInstance(Locale.US);
NumberFormat enGB = NumberFormat.getCurrencyInstance(Locale.UK);
NumberFormat svSE = NumberFormat.getCurrencyInstance(new Locale("sv", "SE"));
double cost = 1020d;
String fmt = "en_US: %s en_GB %s sv_SE %s";
String text = String.format(fmt, enUS.format(cost), enGB.format(cost), svSE.format(cost));
Log.e("Format", text);
> Format﹕ en_US: $1,020.00 en_GB £1,020.00 sv_SE 1 020:00 kr
他们说格式应该是“1 020,00 kr”。当我检查格式对象时,它看起来像符号表中有“,”的decimalSeparator,而是“:”的“货币选择器”。
有谁知道是否:实际上是正确的,这是否是Android/java中的错误,或者任何类型的解决方法?
2014-01-15
Paul
+0
您使用的是什么版本的java?在1.6.0_10我的输出是'en_US:$ 1,020.00 en_GB£1,020.00 sv_SE 1 020,00 kr'它显示正确的格式。 –