Created
February 11, 2017 20:37
-
-
Save vvviiimmm/413ef396765999b0a5b0b53f5cd1eac4 to your computer and use it in GitHub Desktop.
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
case class StringOps(str: String) { | |
def yell = str.toUpperCase() + "!" | |
def isQuestion = str.endsWith("?") | |
} | |
implicit def stringToStringOps(str: String): StringOps = StringOps(str) | |
"Hello world".yell // evaluates to "HELLO WORLD!" | |
"How are you?".isQuestion // evaluates to 'true' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment