-
-
Save albodelu/b56df7040aba4eb533e7d0e2d5a12129 to your computer and use it in GitHub Desktop.
Operator Overloading
This file contains hidden or 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