In addition to Kim, answer that the Java Formatter accepts positional parameters. For instance:
"%2$s %1$s".format(firstName, lastName)
In addition, there is an Enhanced Strings plugin that allows you to insert arbitrary expressions into strings. For instance:
@EnhanceStrings // enhance strings in this scope trait Example1 { val x = 5 val str = "Inner string arithmetics: #{{ x * x + 12 }}" }
See also question for more answers, as this is a really close duplicate.
source share