%P for Stringtemplates
At the moment the injection of string templates doesn't work as aspected!
`%S` also handles the escaping of the dollar signs ($) which is why it is not suitable when a string template should emitted into the generation. If you do it anyway the generated code my fail to compile.
If you need to generate string templates, use `%P` which doesn't escape the dollar signs. It works also when you put it as argument to a `CodeBlock`.
Lets make a small example, how you could insert a template to use a variable in a string.
val property: PropertySpec = PropertySpec.builder("amount", Int::class)
.initWith("%L", 10)
.build()
val functionSpec: FunctionSpec = FunctionSpec.builder("print", String::class)
.addCode("print('Your amount is %P')", property)
.build()// Some codeLast updated