Last active
April 11, 2017 07:01
-
-
Save basarik/977bc8d49719b024964fdcb598afbb8a to your computer and use it in GitHub Desktop.
format Amount
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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