Scala string template

yura picture yura · Jun 4, 2011 · Viewed 8.2k times · Source

Is there default(in SDK) scala support for string templating? Example: "$firstName $lastName"(named not numbered parameters) or even constructs like for/if. If there is no such default engine, what is the best scala library to accomplish this.

Answer

Kim Stebel picture Kim Stebel · Jun 4, 2011

If you want a templating engine, I suggest you have a look at scalate. If you just need string interpolation, "%s %s".format(firstName, lastName) is your friend.