progs/lecture2.scala
author Christian Urban <urbanc@in.tum.de>
Thu, 10 Nov 2016 16:10:39 +0000
changeset 36 f5ed0fef41b3
parent 13 0ce25f816414
child 37 38f3868891f0
permissions -rw-r--r--
updated

// sudoku
// some none




// Implicits
//===========
//
// for example adding your own methods to Strings:
// imagine you want to increment strings, like
//
//     "HAL".increment
//
// you can avoid ugly fudges, like a MyString, by
// using implicit conversions


implicit class MyString(s: String) {
  def increment = for (c <- s) yield (c + 1).toChar 
}

"HAL".increment