[stringtemplate-interest] Question on index with an offset in a sub-template

Jiwon Seo jiwon at stanford.edu
Sat Feb 11 19:52:44 PST 2012


Hi,

I have a question and/or a suggestion.

I want to use an index with a specified offset in a subtemplate. I
understand that currently you can use an index starting from 0 or 1
like following:

<attrs:{a| <a> is <i0>th item}; separator=", ">.

which will give the following result if attrs is ["apple", "orange"]

apple is 0th item, orange is 1th item.

However, I have an offset for the index and want to use it something
like following:

<attrs:{a| <a> is <i.(offset)>th item}; separator=", ">.

Where offset is an (integer) attribute.

Is it possible to do this? If not, do you guys think it's a good idea
to add this to StringTemplate?

Thanks,

-Jiwon


More information about the stringtemplate-interest mailing list