currency

fun currency(currency: Currency? = null, decimals: Int? = null, locale: Locale = Locale.getDefault(), nullText: String = ""): (Any?) -> String(source)

Formats a Number as money, with the currency symbol and separators of a locale.

Parameters

currency

Currency to render in, overriding the one locale implies. Use it when the amounts are in a fixed currency but the separators should follow the user — Currency.getInstance("KES") with a French locale gives 1 299,00 KES.

decimals

Digits after the decimal separator. Defaults to whatever the currency uses, which is 2 for most and 0 for the likes of JPY.

locale

Decides the symbol, the separators, and where the symbol sits.

nullText

What a null value renders as.