Scala Goodness: RichString

Scala is a marvelous beast. Fire up the Scala shell and enter:

How can that be? "capitalize" is of type java.lang.String, and the Java class does not have a capitalize method. But the Scala RichString methods has (Scala 2.8 will use StringOps). And there are more methods to RichString, like reverse, drop, toDouble, toInt and toLong

Another nice one, is format. Not as nice as as GStrings in Groovy, but nevertheless:

How can Scala do this? There is a conversion going on in Scala, which automatically converts your Java String to RichString when the method cannot be found in String but in RichString. The relevant code is in Predef (look for yourself and see how deep the rabbit-hole goes):

Scala Glory!

111 thoughts on “Scala Goodness: RichString”

  1. Pingback: best
  2. Pingback: fucoxanthin
  3. Pingback: geniux pills
  4. Pingback: intelligex
  5. Pingback: intellux
  6. Pingback: probrain
  7. Pingback: radian-c
  8. Pingback: supreme antler
  9. Pingback: genius reviews
  10. Pingback: testomax
  11. Pingback: alpha f1
  12. Pingback: alpha fuel
  13. Pingback: alpha man pro
  14. Pingback: alpha peak
  15. Pingback: alpha xtrm
  16. Pingback: caralluma extract
  17. Pingback: anabolic rx24
  18. Pingback: garcinia melt
  19. Pingback: max synapse
  20. Pingback: nerventrax
  21. Pingback: premium cleanse
  22. Pingback: zynev
  23. Pingback: pro forskolin
  24. Pingback: forskolin slim
  25. Pingback: garcinia cleanse
  26. Pingback: garcinia xt
  27. Pingback: vitapulse
  28. Pingback: Vita pulse
  29. Pingback: vitapulse reviews
  30. Pingback: pure colon detox
  31. Pingback: pure colon detox
  32. Pingback: somnapure
  33. Pingback: perfect biotics
  34. Pingback: vitapulse scam
  35. Pingback: vitapulse
  36. Pingback: vita pulse
  37. Pingback: probiotic america
  38. Pingback: the bull
  39. Pingback: taurus traits
  40. Pingback: Fat Loss Factor
  41. Pingback: Diabetes Free pdf
  42. Pingback: Alexapure Pro
  43. Pingback: Ecomaxx
  44. Pingback: T90 Xplode Review
  45. Pingback: Maxtropin
  46. Pingback: Tea Tox Review
  47. Pingback: MegaDrox Reviews
  48. Pingback: Test X180 Reviews
  49. Pingback: Test X180 Reviews

Comments are closed.