I want to format a currency number to 2 decimal places if there are cents, or no decimal places if there are none.
For example, 1 would show as $1. 1.1 would show as $1.10.
Is there an easy way to do this in Android with Kotlin?
I've used DecimalFormat("$#,###,##0.##). The main issue with this is 1.1 would appear as $1.1. Tried to also use DecimalFormat($#,###,##0.#0) app crashes because it says I can't after the 0 after the # at the 12th position.