The standard library’s String class provides many useful string-related functions. Here are some examples to give you a sense of the available operations.
When you run this program, you’ll see:
In Scala, many of these operations are methods on the String class itself, rather than functions in a separate package. This allows for a more object-oriented style of programming.
Also, Scala provides some additional convenience methods. For example, instead of a separate Repeat function, Scala allows you to multiply a string by a number to repeat it.
The mkString method on collections (like List) is used to join elements, which is equivalent to the Join function in some other languages.