/ scala

TOTD: Scala - String Interpolators

In Scala, you can use string interpolators to format your strings. There are several and the one we'll look at today is f. This interpolator allows you to use printf C-style formatting in your strings.

val height = 70.5
f"$height%2.2f"

This gives you the neatly formatted string of 70.50. See the docs.