2021年1月15日星期五

Remove trailing zeros from currency string android

I tried to convert int to curency format and everything worked as I expected

example 1000 --> Rp1.000

but on certain devices the results are not what I expected
i.e. 1000 --> Rp1.000,00

So the question is how to remove the last 2 extra nolls if the device displays them.

my current code:

    public static String toUang(String DigitUang) {            return NumberFormat.getCurrencyInstance(new Locale("in", "ID")).format(Double.parseDouble(DigitUang));      }  
https://stackoverflow.com/questions/65745805/remove-trailing-zeros-from-currency-string-android January 16, 2021 at 10:03AM

没有评论:

发表评论