Strings In Scala
At first glance, a Scala String appears to be just a Java String. Indeed, a Scala String is a Java String, so you can use all the normal java Strings methods. Calling getName method on String class results a java.lang.String. Calling getName method of String class in REPL You can create a String variable, albeit in the Scala way. val s = "Hello, World" // Immutable String s represents "Hello, World" You can get the length of a String s.length // 12 You can concatenate Strings val s = "Hello" + "World" Magic Of Implicit Conversions: The above all are familiar operations. In Scala, Strings instances also have access to all the methods of the StringOps class. So you can do many other things with them , for example, treating String instance as a sequence of characters. As a result, you can iterate over every character in the String using foreach method. scala > "Hello".foreach(println) ...