As a brief tip, here’s an example of how to capitalize every word in a string in Scala:
"foo bar baz".split(" ").map(_.capitalize).mkString(" ")
The output of that expression is:
Foo Bar Baz
Also, instead of using the underscore character inside of
map, you can write that anonymous function like this, if you prefer:
"foo bar baz".split(" ").map(s => s.capitalize).mkString(" ")
If you wanted to see how to capitalize every word in a Scala string, I hope that’s helpful. Also, if the map method doesn’t make any sense to you, check out my How to write a 'map' function in Scala lesson.