How to check using the StringTemplate if the array is not empty?
The example below doesn't work:
<if(teams.length > 0)>
<ul>
<teams:{team | <li><team></li> }>
</ul>
<endif>
Other (not working) Exaple:
String content = "<if(teams)>list: <teams;separator=\", \"><endif>";
ST template = new ST(content);
template.add("teams", new Long[]{123L, 124L});
System.out.println(template.render());
System.out.println("--------");
content = "<if(teams)>list: <teams;separator=\", \"><endif>";
template = new ST(content);
template.add("teams", new Long[]{});
System.out.println(template.render());
Output:
list: 123, 124
--------
list: