I am trying to generate code with stringtemplate4, and I have a line like this:
"<if(A)>\"A\":\"<A>\"<endif>, <if(B)>\"B\":\"<B>\"<endif>, <if(C)>\"C\":\"<C>\"<endif>"
so A, B and C are optional parameters that if they are not set, I don't want the whole statement to be in the output string. That part is working fine but the comma after the statement is my problem, I don't want the comma to be there as well. I can have the comma inside the string (like "," but then I might end up with an extra comma at the end. I think one way is to do it like a list but I don't know how to define that. this is not working:
"<[{<if(A)>\"A\":\"<A>\"<endif>,<if(B)>\"B\":\"<B>\"<endif>}]; separator=\",\">"
Any ideas? thanks.
Not sure if I understand your question correctly, but can't just move the comma in the if?