Skip to content

Instantly share code, notes, and snippets.

@basarik
Last active April 11, 2017 07:01
Show Gist options
  • Save basarik/977bc8d49719b024964fdcb598afbb8a to your computer and use it in GitHub Desktop.
Save basarik/977bc8d49719b024964fdcb598afbb8a to your computer and use it in GitHub Desktop.
format Amount
private void formatMonthlyIncomeAmount() {
if (etAmount.getText() != null && etAmount.getText().length() > 3) {
String amountString = etAmount.getText().toString();
String formattedString = (amountString.replace(".", "").replace(",", ""));
BigInteger value = new BigInteger(formattedString);
NumberFormat formatWithoutFraction = NumberFormat.getInstance(new Locale("tr", "TR"));
formattedString = (formatWithoutFraction.format(value));
etAmount.setText(formattedString);
etAmount.setSelection(etAmount.getText().length());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment