[stringtemplate-interest] Filtering a list

Bogdan Calmac bc4all at gmail.com
Sun Apr 22 18:52:21 PDT 2007


Hi Ter,

Yes, you're right, that works fine.

Thanks,

Bogdan.

On 4/13/07, Terence Parr <parrt at cs.usfca.edu> wrote:
>
> On Apr 13, 2007, at 7:33 AM, Bogdan Calmac wrote:
>
> > Hi Ter,
> >
> > Thanks, but actually I need the oposite here, to force a null instead
> > of empty string.
>
> Ah. then you need to set null not "" I'm afraid.
>
> > Again, in my example I have a list of persons with a "smart" boolean
> > field and I want to print a comma separated list of the smart people.
> > This requires to filter out those persons which are not "smart", which
> > means returning null from an <if> expression so that I don't get empty
> > slots in the list.
>
> Oh, that's easy:
>
> $names{n | $if(n.smart)$$n$$endif$}; separator=", "$
>
> Let me know if that works for you.  Assuming names i s alist of Name
> objects or whatever.
>
> Ter
>
>


More information about the stringtemplate-interest mailing list