如何从 ant CSV 属性中提取第一个元素 [英] how do I extract the 1st element from a ant CSV property
问题描述
给定一个 CSV 蚂蚁属性,
given a CSV ant property,
<property name="module.list" value="mod1,mod2,mod3,mod4,mod5"/>
我怎样才能获得第一个元素(即这里的mod1")?我想执行一个将mod1"作为参数之一的命令.
how can I just get the first element (ie "mod1" here)? I want to execute a command that will take in "mod1" as one of the arguments.
此外..我无法将这个原始的module.list"属性修改为列表或其他任何内容..虽然我可以从中创建另一个列表、属性等..
Moreover.. I cannot modify this original "module.list" property to a list or anything else.. although I can create another list,property,etc from this..
感谢任何帮助..谢谢
推荐答案
如果您想使用所有变量,您还可以查看 Ant-Contrib 任务 for 和 foreach.
You can also take a look at Ant-Contrib tasks for and foreach, if you want to use all variables.
<echo message="The first five letters of the alphabet are:"/>
<for list="a,b,c,d,e" param="letter">
<sequential>
<echo>Letter @{letter}</echo>
</sequential>
</for>
http://ant-contrib.sourceforge.net/tasks/tasks/index.html
为了用户For Task,不要忘记声明这个任务def:
In order to user For Task, don't forget to declare this task def :
<taskdef resource="net/sf/antcontrib/antlib.xml" />
这篇关于如何从 ant CSV 属性中提取第一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!