score:-1

It's built into the language (in an extendable way). Just

val obj = Obj("replacement")
s"xx ${obj.str} xx"

You can have any Scala expression inside ${...}.

See http://docs.scala-lang.org/overviews/core/string-interpolation.html (or just search for "Scala string interpolation") for more.

score:0

Try to create your class like this:

    case class Obj(@BeanProperty str: String)

Here is the scala doc: http://www.scala-lang.org/api/current/#scala.beans.BeanProperty

Also you can take a look at the project Scalasti which is a interface for StringTemplate: http://software.clapper.org/scalasti/


Related Query

More Query from same tag