Scala String formatting FAQ: How do I write code that is equivalent to the Java String.format class? That is, how do I format strings like that in Scala?
In Java I always write code like this to format a String:
String.format("%s %s, age %d", firstName, lastName, age)
but if you try that in Scala, you'll get a long and unusual error message.
The Scala String formatting approach
The short answer is that in Scala your String format code will now look like this: