Skip to content

Instantly share code, notes, and snippets.

@budioktaviyan
Created June 20, 2021 04:36
Show Gist options
  • Save budioktaviyan/c061d56faa3d11f870e16ccca53e3f3e to your computer and use it in GitHub Desktop.
Save budioktaviyan/c061d56faa3d11f870e16ccca53e3f3e to your computer and use it in GitHub Desktop.
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) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment