[stringtemplate-interest] Newbie- if conditional question

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Thu Mar 26 16:06:40 PDT 2009


Bharani Ellore wrote:
> I have the code in my template.st
> 
> $outputs: { bo |
> 
>        $if(length(strip(bo.sourceWire)))$
> 
>             $bo.label$ zzz
> 
>         $endif$
> 
> }$
> 
> 
> where bo.sourceWire is a <list>. Basically I was to print the label if 
> the itemList has atleast one string. But somehow it is printing all the 
> items in $bo$ even though some of them are empty lists.
> 
> This expression does print number ranging from 0-9. So I know all item 
> should not be printed.
> $length(strip(bo.sourceWire))$
> 
> 
> What am I doing wrong? Any help?

Based on my own first reading of the docs, today, ISTR that $if$ only 
checks for null or boolean false, not zero, to count as "not" doing it.

-- 
Sam Barnett-Cormack


More information about the stringtemplate-interest mailing list