Currency

data class Currency(val currencyCode: String? = null, val minIntegerDigits: UInt, val maxIntegerDigits: UInt, val minFractionDigits: UInt? = null, val maxFractionDigits: UInt? = null, val roundingMode: RoundingMode = RoundingMode.HalfEven) : NumberFormatStyle

Formats a number to a currency of a given currency code fitting its locale. Note: Some platforms may use different delimiters between the currency symbol and the number (if present for the locale). For instance, iOS often uses a non-breaking space, whereas Android uses a common space. This inconsistency is not corrected by this library and should thus be manually corrected if required.

Parameters

currencyCode

The currency code to format for. When null defaults to the currency of the locale Defaults to null.

minIntegerDigits

The minimum number of integer digits to show. Defaults to 0U.

maxIntegerDigits

The maximum number of integer digits to show. Defaults to 309U.

minFractionDigits

The minimum number of decimal digits to show. Defaults to 0U.

maxFractionDigits

The maximum number of decimal digits to show. When null uses the preferred faction digits of the currency. Defaults to null.

roundingMode

The RoundingMode to be applied. Defaults to RoundingMode.HalfEven.

Constructors

Link copied to clipboard
constructor(currencyCode: String? = null, minIntegerDigits: UInt, maxIntegerDigits: UInt, minFractionDigits: UInt? = null, maxFractionDigits: UInt? = null, roundingMode: RoundingMode = RoundingMode.HalfEven)

Properties

Link copied to clipboard
val currencyCode: String? = null
Link copied to clipboard
val maxFractionDigits: UInt? = null
Link copied to clipboard
Link copied to clipboard
val minFractionDigits: UInt? = null
Link copied to clipboard
Link copied to clipboard
open override val roundingMode: RoundingMode