Did you know that you can reverse a string by merely upcasing it and then downcasing it again? Here's an example:
scala> val s = "ςσσ"
s: java.lang.String = ςσσ
scala> s.toUpperCase.toLowerCase == s.reverse.toString
res0: Boolean = true
scala>
If you don't believe me, just copy and paste the two lines of code above into the Scala interpreter, and see it for yourself.
2 comments:
...the operative word being a String, i.e. not just any String. :)
Darn --- you called my bluff, Alex :)
/nikolaj
Post a Comment