String string StringTemplate in uppercase

In StringTemplate, there is a built-in way to render a string in uppercase, for example. something like that:

my_template(component) ::= <<

<component.name; format="upper">

>>

... or should I use special rendering for this?

+4
source share
1 answer

I just found this myself. The template in the question is correct. The only thing I need to do is register the inline StringRenderer before rendering the template:

STGroup group = new STGroupFile("my_template.stg");
group.registerRenderer(String.class, new StringRenderer());
+2
source

Source: https://habr.com/ru/post/1538713/


All Articles