[stringtemplate-interest] How to use variables inside format modifiers
Mohamed Mansour
m0.interactive at gmail.com
Fri Jul 31 11:06:35 PDT 2009
Hello,
I have been using StringTemplate to produce stylized report files. Some
variables need to be formatted someway, for example if I want to uppercase a
variable I do, therefore I setup an attribute renderer:
$foo;format="uppercase"$
In my specific case I would need to apply more than one formatter (more than
one attribute renderer for a variable), so I created many attribute renders
and I can process them like:
$foo;format="uppercase|fixedlength:10:x:R|lowercase"$ If you notice a
modifer could have parameters ( with colons as seen with fixedlength)
So if $foo is "123aBc" it will return "XXXX123abc", the above works
perfectly fine
My main problem is that, some parameters in my format modifiers need to be
ST variables, for example, I would need to add a number:
$numA;format="calculate:+:$numB$"$
If numA = 10, and numB = 5, the formatter will return15. But my problem is
that, it treats the variables as a string doesn't actually give me the exact
value of the variable.
How can I pass variables in the "format" area?
Thanks!
-- Mohamed Mansour
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20090731/ab53ca24/attachment.html
More information about the stringtemplate-interest
mailing list