[stringtemplate-interest] Filtering a list

Terence Parr parrt at cs.usfca.edu
Wed Apr 11 07:36:17 PDT 2007


On Apr 11, 2007, at 2:32 AM, Brian Lewis wrote:

> On Fri, 06 Apr 2007 15:25:50 -0400
> Bogdan Calmac <bc4all at gmail.com> wrote:
>
>> <persons: {<if(it.smart)><it.name><endif>}; separator=",">
>> this would create something like
>> Bill,,Bob,,,Jim
>> with empty spaces for the items filtered out. Could you suggest some
>> elegant manner to do this?
>
> I guess I think you should make a smartPeople collection and pass  
> *that*
> to ST rather than trying to do it within ST.

Hi. Sorry for my silence on the list. just finished the ANTLR book  
(with ST stuff in it) and am racing to fix bugs in ANTLR by end of  
month when I need to release v3.

As your issue, if you send a valid String with no chars in it, ST  
will still print it.  Can you send null instead?

Ter



More information about the stringtemplate-interest mailing list