I am using Velocity Templating Language and currently have:
#set ( $stringList = $string.split(",") )
which works fine and splits the string up using a ‘,’ as a delimiter as expected.
My question is how do i now access each of the elements in the $stringList?
I have tried:
$stringList.get(0)
$stringList[0]
$stringList.[0]
${stringList}.get(0)
I am using Velocity in JIRA and JIRA happens to use Velocity version 1.4 which apparently doesn’t have support for accessing arrays as tried above.
Any help is much appreciated.
It works when I convert the array to a List using Arrays.asList() and then use methods from List to access elements.
I add the following to the context:
In velocity template I use:
With a String-Array as follows
I get the expected output: