在Ant属性替换字符 [英] Replacing characters in Ant property
本文介绍了在Ant属性替换字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有服用一个属性值的简单方法,然后将其复制到带有特定字符的另一个属性替换?
Is there a simple way of taking the value of a property and then copy it to another property with certain characters replaced?
说 propA =这是一个值
。我想要替换所有空间中它变成下划线,致使 PROPB = This_is_a_value
。
Say propA=This is a value
. I want to replace all the spaces in it into underscores, resulting in propB=This_is_a_value
.
推荐答案
使用 propertyregex 从任务蚂蚁的Contrib 。
我觉得你想要的:
<propertyregex property="propB"
input="${propA}"
regexp=" "
replace="_"
global="true" />
不幸的是给出的例子并不十分清楚,但它是值得一试的。您也应该检查是否没有任何下划线会发生什么 - 你可能需要使用设置defaultValue
选项以及
这篇关于在Ant属性替换字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文