Skip to content

Instantly share code, notes, and snippets.

View budioktaviyan's full-sized avatar
🇸🇬

Budi Oktaviyan budioktaviyan

🇸🇬
View GitHub Profile
@budioktaviyan
budioktaviyan / Version.kt
Created June 20, 2021 04:36
Check application version for Android
object version {
val String.isStable: Boolean
get() = !this.isNotStable
val String.isNotStable: Boolean
get() = listOf("alpha", "beta", "cr", "m", "preview", "b", "ea")
.map { label -> Regex("(?i).*[.-]$label[.\\d-+]*") }
.any { regex -> regex.matches(this) }
}