Skip to content

Instantly share code, notes, and snippets.

@windmaomao
Last active September 4, 2020 18:59
Show Gist options
  • Save windmaomao/5a78e9dc5ff71c99ad5b7a89c479a14f to your computer and use it in GitHub Desktop.
Save windmaomao/5a78e9dc5ff71c99ad5b7a89c479a14f to your computer and use it in GitHub Desktop.
fun String.extractNumbers(): List<Int> =
"""\d+""".toRegex()
.findAll(this)
.map { it.value.toInt() }
.toList()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment