I'd like to use NumberFormat
to convert a Double
to a String
. I'm currently using a NumberFormat
based on a currency locale but this rounds the Double
to 2 decimal places. How could I get it to not round the currency so that it includes fractional pennies?
So if I have
val doubleFormatMoney = 1.032323135
val format = NumberFormat.getCurrencyInstance(Locale.US)
val stringFormatMoney = format.format(doubleFormatMoney)
Then we should have stringFormatMoney = $1.032323135
but instead I get stringFormatMoney = $1.03