Skip to content

Instantly share code, notes, and snippets.

@btakashi
Created July 20, 2011 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btakashi/1094784 to your computer and use it in GitHub Desktop.
Save btakashi/1094784 to your computer and use it in GitHub Desktop.
#7 Daimon-scala problem, reverse case
class CaseReversibleString(s:String) {
def reverseCases = (for (c <- s.toCharArray) yield {
if (c.isUpper) c.toLower
else c.toUpper
}).mkString
}
implicit def string2CaseReversibleString(s:String) = new CaseReversibleString(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment