如何蚂蚁可以从文件中读取到一个属性值的价值? [英] How Ant can get a value read from a file into a property value?

查看:126
本文介绍了如何蚂蚁可以从文件中读取到一个属性值的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文件如下:

a1,b1
a2,b2
...

我知道值A2。
如何获取值B2到属性值。

I know the value "a2". How to get the value "b2" into a property value.

我知道如何选择包含A2的行:

I know how to select line which contains "a2" by:

<linecontains>
  <contains value="a2"/>
</linecontains>

我不知道如何设置属性值设置为B2。
我在您的处置更多其他信息。

But I do not know how to set a property value to "b2". I am at your disposal for more other information.

推荐答案

下面的伎俩对我来说:

<loadfile srcfile="data" property="result">
     <filterchain>
           <linecontains>
                <contains value="a2"/>
           </linecontains>
           <tokenfilter>
                <replacestring from="a2," to=""/>
           </tokenfilter>
    </filterchain>
</loadfile>
<echo message="${result}"/>

正如您所指出的,第一行的A2将被选中。该tokenfilter然后替换A2和一无所有结肠。希望有所帮助。

As you pointed out, first the line the the 'a2' will be selected. The tokenfilter then replaces a2 and the colon with nothing. Hope that helps.

这篇关于如何蚂蚁可以从文件中读取到一个属性值的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆