I have my array as below in java string template:
$colors:{ color |
<p>$color.name$
}$
Output is :
Green
Black
The output is want is:
1. Green
2. Black
How do I achieve this? How to get the incremented counter in antlr.stringtemplate ?
You can use built-in attribute $i$
to start enumeration from one, or $i0$
- from zero.
$colors:{ color |
<p>$i$. $color.name$
}$
Please, also see another example usage in ST3 GIT repo.