Skip to content

Instantly share code, notes, and snippets.

@Atternatt
Created April 23, 2017 22:31
Show Gist options
  • Save Atternatt/0a2e8da39570db2ed8f318df32cec4a1 to your computer and use it in GitHub Desktop.
Save Atternatt/0a2e8da39570db2ed8f318df32cec4a1 to your computer and use it in GitHub Desktop.
Operator Overloading
operator fun String.get(intRange: IntRange): String {
return this.substring(intRange)
}
val firstSentence = "hello Marc!"
val secondSentence = "World Wide"
val mixedSentence = firstSentence[0..4] + secondSentence[0..4]
//Hello World
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment