split a string in velocity Template and access it by index in velocity
<p>I am trying to split a string in velocity using split() given below:</p>

<pre><code>#foreach ($element in $string.split(":"))
    #if($velocityCount &gt;1)
    #foreach ($var in $element.split(","))
    #if($velocityCount ==1)
    @Param("$var") String $var,
#end
#end
#end
#end
</code></pre>

<p>I want to store the splitted string in an array and want to access it by index as we do in java.</p>

<pre><code>String s[]=str.split(".");
s[0];
</code></pre>

<p>Is there anything similar to above java code in velocity?</p>