Skip to content

Instantly share code, notes, and snippets.

@enginebai
Created May 14, 2022 13:58
Show Gist options
  • Save enginebai/ea29f6425317eb6982ad5c34263c0aa1 to your computer and use it in GitHub Desktop.
Save enginebai/ea29f6425317eb6982ad5c34263c0aa1 to your computer and use it in GitHub Desktop.
class Version {
var major: Int?
var minor: Int?
var patch: Int?
fun String.toVersion(): Version? {
val split = this.split(".")
return Version(split[0].toInt(), split[1].toInt(), split[2].toInt())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment