I have a ant parameter with list of values as below.
releases=release1,release2
I use the below for loop to process the values.
<for list="${releases}" param="release">
<sequential>
<echo>Processing @{release}</echo>
</sequential>
<for>
I want to do something like, I want to echo the below statement only when the @{release}=release2
<echo>Processing last release</echo>
I am not quite sure how to get the index of the list items or if it is even possible.
Thanks in advance,
Balaji
That’s all? And, you’re using Ant-Contrib tasks already. Take a look at the PropertyRegEx task. That’s the Ant-Contrib task that will do exactly what you want:
This will set
${last.release}to the last release in your string.Be careful of strings that are null or don’t match your regular expression! You can use the Ant-Contrib
iftask to test for that: