[stringtemplate-interest] String manipulations
Terence Parr
parrt at cs.usfca.edu
Wed Aug 30 14:11:26 PDT 2006
On Aug 28, 2006, at 11:32 PM, Emond Papegaaij wrote:
> On Tuesday 29 August 2006 02:50, Terence Parr wrote:
>> On Aug 28, 2006, at 9:07 AM, Emond Papegaaij wrote:
>>> First of all: StringTemplate really rocks! It's clean, easy to
>>> use and
>>> really powerful!
>>>
>>> There is however a single problem I keep facing. In many places I
>>> have to
>>> generate get- and set-methods for properties. For example the
>>> property 'value' will get the methods 'getValue' and 'setValue'.
>>> Right now
>>> I'm passing both the lower case 'value' and the upper case
>>> 'Value' to
>>> these templates, but this is rather cumbersome. Is there any way to
>>> perform simple string transformations with StringTemplate? That
>>> would
>>> greatly simplify most of my templates.
>>
>> Hi. Is this C#?
>
> No, Java.
Ah. Ok, well, currently we have no "capitalize" predefined method.
I suggest overriding setAttribute in ST to autowrap each String with
another object that adds a capitalize method. Costs memory, but for
now that is an easy solution. There are anumber of these like
"escape URL".
Ter
More information about the stringtemplate-interest
mailing list