/kotlin

Validate Swedish personal identity numbers

Primary LanguageKotlinMIT LicenseMIT

Personnummer

GitHub Workflow Status

Validate Swedish personal identity numbers with Kotlin. Heavily inspired by the Java implementation by @Johannestegner, thank you!

Example

import personnummer.Personnummer

fun main(args: Array<String>) {
    Personnummer.valid(8507099805L)     // => true
    Personnummer.valid("198507099805")  // => true
}

More examples in the src/test/kotlin/PersonnummerTest.kt.

Linting

This code is linted with ktlint. See ktlint documentation for details.

License

MIT