Skip to content
Advertisement

Simple way templating multiline strings in java code

I’m often run in to the following situation: I have long multiline strings where properties must be injected – e.g. something like templating. But I don’t want to inlcude a complete templating engine (like velocity or freemarker) in my projects.

How can this be done in a simple way:

JavaScript

Advertisement

Answer

You can create your own small & simply template engine with few lines of code:

JavaScript

and small text file e.g. in the same folder (package) demo.mail:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement