I need an st4 expression to render an element if a string is not empty:
<if(theString)>...<endif> does not work - it seems to only work for arrays.
I've tried if(theString.length > 0) and all kinds of stuff, but it looks like it this only works for variables that are not set or for arrays.
I am iterating over a list and rendering this, so I could have values in the middle that are empty strings that I don't want to render anything at all for.
I've been struggling trying to find the ability to compare strings in a conditional. I want to be able to test for a condition like
obj.Name == 'foobar'. Not sure if stringtemplate-4 can do it?To render if the value is not null you should be able to do the following.
But to find the length of a string you can use
strlenfunction.ie.
Here is a helpful list of all the functions: https://github.com/antlr/stringtemplate4/blob/master/doc/cheatsheet.md