Skip to content

Instantly share code, notes, and snippets.

@yuroyoro
Forked from yusuke/gist:1094792
Created July 20, 2011 11:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuroyoro/1094820 to your computer and use it in GitHub Desktop.
Save yuroyoro/1094820 to your computer and use it in GitHub Desktop.
#daimon.scala
object Main extends App {
trait Reversible {
val s:String
def reverseOrder = s reverse
def reverseCases = s collect{
case c if c.isUpper => c.toLower
case c if c.isLower => c.toUpper
case c => c
}
}
implicit def string2Reversible(str:String) = new Reversible{ val s = str }
println("AbcDEf123".reverseOrder)
println("AbcDEf123".reverseCases)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment