Created
April 23, 2017 22:31
-
-
Save Atternatt/0a2e8da39570db2ed8f318df32cec4a1 to your computer and use it in GitHub Desktop.
Operator Overloading
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
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