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));
    }


Read more here: https://stackoverflow.com/questions/65745805/remove-trailing-zeros-from-currency-string-android

Content Attribution

This content was originally published by M Hasan Nudin at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: