4

In StringTemplate, is there a built-in way to render a string as uppercase, e.g. something like this:

my_template(component) ::= <<

<component.name; format="upper">

>>

... or do I have to use a custom renderer for this purpose?

geschema
  • 2,464
  • 4
  • 30
  • 41

1 Answers1

3

I've just found it out by myself. The template in the question is correct. The only thing I need to do is register the built-in StringRenderer before rendering the template:

STGroup group = new STGroupFile("my_template.stg");
group.registerRenderer(String.class, new StringRenderer());
geschema
  • 2,464
  • 4
  • 30
  • 41