commonMain.inkapplications.spondee.measures.Cardinal.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of measures-js Show documentation
Show all versions of measures-js Show documentation
A class set for wrapping units of measure in an application.
package inkapplications.spondee.measures
/**
* Geographic Direction
*/
enum class Cardinal(val symbol: Char, internal val decimalSign: Int) {
North('N', 1),
East('E', 1),
South('S', -1),
West('W', -1)
}
/**
* Convert a single character to a cardinal direction.
*/
fun Char.toCardinal(): Cardinal = Cardinal.values().first { it.symbol == toUpperCase() }