Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

io.fluidsonic.currency:fluid-currency-metadata

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io.fluidsonic.currency:fluid-currency-metadata

Kotlin multiplatform currency library

  • 0.9.1
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

fluid-currency

Maven Central JCenter 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.1")
}

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

FAQs

Package last updated on 24 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc