Skip to content

Instantly share code, notes, and snippets.

@odaridavid
Created May 9, 2020 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odaridavid/04dfc925a664eb194a8c7704841ab155 to your computer and use it in GitHub Desktop.
Save odaridavid/04dfc925a664eb194a8c7704841ab155 to your computer and use it in GitHub Desktop.
Blog Dynamic Url
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