[英]Android - How To Seperate Amount of Money Text with dot and comma
I have editText
and textView
which I want to seperate and detect thousands automatically.我有
editText
和textView
,我想将它们分开并自动检测数千个。
Here is user types;这是用户类型; ($) 72500 Here is what I want to see: 72.500,000
($) 72500 这是我想看到的:72.500,000
With this code, I can only seperate first section;使用此代码,我只能将第一部分分开;
public String textFormatter(double formatThis){
String str = String.format("%,d", (int) formatThis);
return str;
}
you can use like that in your method:你可以在你的方法中这样使用:
NumberFormat numFormater = NumberFormat.getCurrencyInstance();
System.out.println(numFormater.format(new BigDecimal("72500")));//$72,500.00
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.