Created
May 9, 2020 17:28
-
-
Save odaridavid/04dfc925a664eb194a8c7704841ab155 to your computer and use it in GitHub Desktop.
Blog Dynamic Url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val String.id: Int | |
get() = | |
if (this.isNotBlank() && this.contains("-?\\d+(\\.\\d+)?".toRegex())) | |
this.replace("[^0-9]".toRegex(), "").toInt() | |
else -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment