fluid-currency
Kotlin multiplatform currency library.
This is most useful in combination with fluid-i18n for retrieving internationalized information about a currency.
Installation
build.gradle.kts
:
dependencies {
implementation("io.fluidsonic.currency:fluid-currency:0.13.0")
}
Usage
println(Currency.fromCode("EUR"))
class Currency
A class with information about a specific currency defined by ISO 4217.
val currency = Currency.forCode("EUR")
println(currency.code)
println(currency.defaultFractionDigits)
println(currency.numericCode)
val currency = Currency.forCodeOrNull("ABC123")
println(currency)
class CurrencyCode
An inline class for ISO 4217 3-letter currency codes (e.g. EUR
or USD
).
val code = CurrencyCode.parse("EUR")
println(code.toString())
println(code.isValid())
val code = CurrencyCode.parse("abc")
println(code.toString())
println(code.isValid())
val code = CurrencyCode.parseOrNull("ABC123")
println(code)
License
Apache 2.0