fluid-currency

Kotlin multiplatform currency library

Лицензия

Лицензия

Категории

Категории

Данные
Группа

Группа

io.fluidsonic.currency
Идентификатор

Идентификатор

fluid-currency-metadata
Последняя версия

Последняя версия

0.9.1
Дата

Дата

Тип

Тип

module
Описание

Описание

fluid-currency
Kotlin multiplatform currency library
Ссылка на сайт

Ссылка на сайт

https://github.com/fluidsonic/fluid-currency
Система контроля версий

Система контроля версий

https://github.com/fluidsonic/fluid-currency

Скачать fluid-currency-metadata

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib-common jar 1.4.0

Модули Проекта

Данный проект не имеет модулей.

fluid-currency

Maven Central Tests Kotlin #fluid-libraries Slack Channel

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.9.5")
}

Usage

println(Currency.fromCode("EUR")) // EUR

class Currency

A class with information about a specific currency defined by ISO 4217.

val currency = Currency.forCode("EUR") // throws if code is invalid (not defined by ISO 4217) or has an invalid format (not three latin letters)
println(currency.code) // EUR
println(currency.defaultFractionDigits) // 2
println(currency.numericCode) // 978
val currency = Currency.forCodeOrNull("ABC123") // null if code is invalid (not defined by ISO 4217) or has an invalid format (not three latin letters)
println(currency) // null

class CurrencyCode

An inline class for ISO 4217 3-letter currency codes (e.g. EUR or USD).

val code = CurrencyCode.parse("EUR") // throws if code has invalid format (not three latin letters)
println(code.toString()) // EUR
println(code.isValid()) // true - 'EUR' is defined by ISO 4217
val code = CurrencyCode.parse("abc") // throws if code has invalid format (not three latin letters)
println(code.toString()) // ABC
println(code.isValid()) // false - 'ABC' is not defined by ISO 4217
val code = CurrencyCode.parseOrNull("ABC123") // null if code has invalid format (not three latin letters)
println(code) // null

License

Apache 2.0

Версии библиотеки

Версия
0.9.1
0.9.0