[stringtemplate-interest] [ST4] How to apply multiple "format"s to an expression?

Udo Borkowski ub at abego-software.de
Fri Feb 18 14:02:23 PST 2011


Hi,

I would like to generate a constant definition like this:

	public static final int ABC             = 123;
	public static final int GHIJKLMN        = 456;

To make sure the "="s are aligned I can use the Java String format padding feature, e.g. use a template like this:

t1(n,v) ::= <<
public static final int «n;format="%-15s"» = «v»;
>>

However the name is given in mixed case and I need to "upper" it, e.g. with something like this:

t2(n,v) ::= <<
public static final int «n;format="upper"» = «v»;
>>

Is there a way to combine both formats, so I get an uppercased, right padded name?


Udo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110218/0778e4e1/attachment.html 


More information about the stringtemplate-interest mailing list