Skip to content

Instantly share code, notes, and snippets.

@drulabs
Created August 8, 2018 06:24
Show Gist options
  • Save drulabs/bb230439006fe47cceb58ac49393cf3a to your computer and use it in GitHub Desktop.
Save drulabs/bb230439006fe47cceb58ac49393cf3a to your computer and use it in GitHub Desktop.
val blank = " ".isBlank() // true
val first = "Kaushal.Dhruw".substringBefore('.') // "Kaushal"
val last = "Kaushal.Dhruw".substringAfter('.') // "Dhruw"
val addSpaces = "1".padStart(2) // " 1"
val addSpacesEnd = "1".padEnd(3, '0') // "100"
val dropStart = "Dhruw".drop(2) // "ruw"
val dropEnd = "Dhruw".dropLast(2) // "Dhr"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment