[stringtemplate-interest] formatting the last element of a list

Terence Parr parrt at cs.usfca.edu
Tue May 29 13:34:02 PDT 2007


Try trunc(list) :)

Ter
On May 29, 2007, at 10:02 AM, George Berger wrote:

> Hi -
>
> I'm trying to figure out how to format a list that requires special  
> treatment for the last element.  E.g., given a list like this:
>
>    [ "Joe", "Bob", "Alice" ]
>
> I'd like to output a string that looks like this:
>
>  Hello Joe, Bob, and Alice.
>
> It seems like I need a function that corresponds to last() in the  
> same way that rest() corresponds to first(), but I don't see  
> anything like that in the docs.
>
> Any suggestions for how to implement this would be appreciated.
>
> George
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list