[stringtemplate-interest] String manipulations
Emond Papegaaij
e.papegaaij at student.utwente.nl
Fri Sep 29 00:45:37 PDT 2006
On Friday 29 September 2006 03:47, Zenaan Harkness wrote:
> On Thu, Sep 28, 2006 at 11:22:23AM -0700, Terence Parr wrote:
> > On Sep 27, 2006, at 9:39 PM, John Snyders wrote:
> > > To sum up I would like to see option 4 supported and implemented as
> > > you described. The formatting would apply to (the result of)
> > > templates to be consistent with the ;separator.
> >
> > Yes, so I'd evaluate the entire expressions even if
> >
> > $names:{$i$. <b>$it$</b>}$; format="upperCase"$
> >
> > Here, the entire list of crap would be uppercased including the $i$
> > numbers. Right?
>
> Almost. Consider:
>
> $names:{$i$. <b>$it$</b>}$; separator="v"; format="upperCase"$
>
> Now I don't know why you'd want to have a letter as your separator,
> but if you did, you would presumably want to distinguish that from:
>
> $names:{$i$. <b>$it$</b>}$; separator="V"; format="upperCase"$
>
> And so, format="upperCase" would need to apply to each $i$
> separately. Although, could there be a difference with these:
>
> $names:{$i$. <b>$it$</b>}$; separator="v"; format="upperCase"$
> $names:{$i$. <b>$it$</b>}$; format="upperCase"; separator="v"$
>
> Perhaps too surprising to have different behaviours; I think
> the normal expectation is that such operations are commutative
> in their sequence (reversible).
I think you are right here. Different options should not affect eachother.
Your example should upperCase all items, but not the separator. After all
you could always write:
${names:{$i$. <b>$it$</b>}$; separator="v"}; format="upperCase"$
There is however a limitation to option 4: the formatter cannot take
arguments. Therefore it cannot be used for things such as 'substring'
and 'indexof'.
Best regards,
Emond
More information about the stringtemplate-interest
mailing list