fluid-country

Kotlin multiplatform country library

Лицензия

Лицензия

Категории

Категории

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

Группа

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

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

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

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

0.9.2
Дата

Дата

Тип

Тип

module
Описание

Описание

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

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

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

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

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

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

Зависимости

compile (1)

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

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

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

fluid-country

Maven Central JCenter Tests Kotlin #fluid-libraries Slack Channel

Kotlin multiplatform country library.

This is most useful in combination with fluid-i18n for retrieving internationalized information about a country.

Installation

build.gradle.kts:

dependencies {
    implementation("io.fluidsonic.country:fluid-country:0.9.3")
}

Usage

println(Country.fromCode("US")) // US

class Country

A class with information about a specific country defined by ISO 3166-1.

val country = Country.forCode("US") // throws if code is invalid (not defined by ISO 3166-1) or has an invalid format (not two latin letters)
println(country.code) // US
println(country.code(CountryCode.Format.iso3166_alpha3)) // USA
println(country.numericCode) // 840
val country = Country.forCodeOrNull("ABC123") // null if code is invalid (not defined by ISO 3166-1) or has an invalid format (not two latin letters)
println(country) // null

class CountryCode

An inline class for ISO 3166-1 alpha-2 country codes (e.g. US or DE).

val code = CountryCode.parse("US") // throws if code has invalid format (not two latin letters)
println(code.toString()) // US
println(code.isValid()) // true - 'US' is defined by ISO 3166-1
val code = CountryCode.parse("aa") // throws if code has invalid format (not two latin letters)
println(code.toString()) // AA
println(code.isValid()) // false - 'AA' is not defined by ISO 3166-1
val code = CountryCode.parseOrNull("ABC123") // null if code has invalid format (not two latin letters)
println(code) // null

License

Apache 2.0

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

Версия
0.9.2
0.9.1
0.9.0