且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Ant 如何将从文件中读取的值转换为属性值?

更新时间:2023-08-26 20:31:52

以下对我有用:

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

正如您所指出的,首先将选择a2"行.然后令牌过滤器将 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.