该文件如下:
a1,b1
a2,b2
...
我知道值“a2”。 如何将值“b2”转换为属性值。
我知道如何通过以下方式选择包含“a2”的行:
<linecontains>
<contains value="a2"/>
</linecontains>
但我不知道如何将属性值设置为“b2”。 我随时准备了更多其他信息。
答案 0 :(得分:21)
以下是我的诀窍:
<loadfile srcfile="data" property="result">
<filterchain>
<linecontains>
<contains value="a2"/>
</linecontains>
<tokenfilter>
<replacestring from="a2," to=""/>
</tokenfilter>
</filterchain>
</loadfile>
<echo message="${result}"/>
正如您所指出的那样,首先选择'a2'。然后令牌过滤器替换a2和冒号。希望有所帮助。