0

I need to divide a amount on triads when I input its in EditText, how in calculator. Is there a property EditText or I need do this programmatically?

Example: I have: 1000000 I need: 1 000 000 Dividing should occur during the input amount.

Andrew Efremov
  • 423
  • 5
  • 12

1 Answers1

1

This is Decimal formatting. As Described by Andreas_D in

How to set thousands separator in Java?

DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.US);
DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();

symbols.setGroupingSeparator(' ');
formatter.setDecimalFormatSymbols(symbols);
System.out.println(formatter.format(bd.longValue()));
Community
  • 1
  • 1
QAMAR
  • 2,684
  • 22
  • 28