[stringtemplate-interest] dealing with empty list values
Terence Parr
parrt at cs.usfca.edu
Sat Jun 3 15:17:16 PDT 2006
Howdy,
Imagine a list of strings. Some are null. You are generating code
and you want
String[] a = {
"abc",
"",
"def",
"",
"",
};
where the "" values are there when the list element is null.
Currently ST skips these values and you have no chance to insert "".
You must alter the data to have "". This is not so bad UNLESS you
have a List<List<int>>, for example, and the strings are built by ST
not by the model.
Any ideas how we can alter the semantics of ST to allow both skpping
and not skipping of null values in an iteration? Another option on
the <data; noskip> expression?
Ter
More information about the stringtemplate-interest
mailing list