In my code finally amount will be generated. I want to display it in indian rupees format like 10 100 1,000 10,000 1,00,000 10,00,000 1,00,00,000 10,00,00,000 etc. How can i insert commas ? eg: int amount=1000;
Asked
Active
Viewed 9,359 times
2 Answers
3
You can do this by using locale like
Here you can use any locale for your case it should be en_IN
NumberFormat.getCurrencyInstance(locale).format(paramDouble);
Ashok
- 1,241
- 11
- 18
-1
You could use the java.text.DecimalFormat
and do something like this:
DecimalFormat df = new DecimalFormat(###,##0);
DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
dfs.setDecimalSeparator('.');
dfs.setGroupingSeparator(',');
df.setDecimalFormatSymbols(dfs);
df.format(numberToFormat);
Frederic Close
- 9,123
- 6
- 54
- 64