繁体   English   中英

Ant如何将从文件中读取的值读入属性值?

[英]How Ant can get a value read from a file into a property value?

该文件看起来像:

a1,b1
a2,b2
...

我知道价值“a2”。 如何将值“b2”转换为属性值。

我知道如何通过以下方式选择包含“a2”的行:

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

我不知道如何将属性值设置为“b2”。 我随时为您提供更多其他信息。

以下是我的诀窍:

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

正如您所指出的那样,首先选择'a2'。 然后令牌过滤器替换a2和冒号。 希望有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM