提问者:小点点

如何将整个安卓应用程序中的点字符全部改为逗号?


我用了很多带点的十进制字符。 但它们应该用逗号写。 有什么办法能让我改变所有这些吗?


共1个答案

匿名用户

String.format("%,d", number)

DecimalFormat formatter = new DecimalFormat("#,###,###");
String yourFormattedString = formatter.format(5000);

DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(currentLocale);
otherSymbols.setDecimalSeparator(',');
otherSymbols.setGroupingSeparator('.'); 
DecimalFormat df = new DecimalFormat(formatString, otherSymbols);
currentLocale can be obtained from Locale.getDefault() i.e.:

Locale currentLocale = Locale.getDefault();