[stringtemplate-interest] formatting the last element of a list
George Berger
george.berger
Tue May 29 15:40:05 PDT 2007
I tried that build, stringtemplate-05-03-2007.15, but got the same
result. I poked around in the source code that came with it and found
this in ASTExpr.java:
/** Return all but the last element. trunc(x)=null if x is single-valued. */
public Object trunc(Object attribute) {
return null; // not impl.
}
Looks like it's not quite all there yet.
George
On 5/29/07, Terence Parr <parrt at cs.usfca.edu> wrote:
> You need the latest build. 3.0 doesn't have this feature.
>
> http://www.stringtemplate.org/download/build
>
> Ter
> On May 29, 2007, at 2:55 PM, George Berger wrote:
>
> >> Try trunc(list) :)
> >
> > I tried this but got nothing back. Here's my test program:
> >
> > names [$names$].
> >
> > first(names) [$first(names)$].
> > rest(names) [$rest(names)$].
> >
> > trunc(names) [$trunc(names)$].
> > last(names) [$last(names)$].
> >
> > Here's the output:
> >
> > names [JoeBobAlice].
> >
> > first(names) [Joe].
> > rest(names) [BobAlice].
> >
> > trunc(names) [].
> > last(names) [Alice].
> >
> > I'm using stringtemplate-3.0.jar. Do I need something more recent?
> >
> > George
> > _______________________________________________
> > stringtemplate-interest mailing list
> > stringtemplate-interest at antlr.org
> > http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>
--
George
More information about the stringtemplate-interest
mailing list