本文介绍了如何拉出来在蚂蚁一子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法从一个Ant属性拉子并将该子到它自己的财产?
Is there a way to pull a substring from an Ant property and place that substring into it's own property?
推荐答案
我用scriptdef创建JavaScript代码来子,为为例:
I use scriptdef to create a javascript tag to substring, for exemple:
<project>
<scriptdef name="substring" language="javascript">
<attribute name="text" />
<attribute name="start" />
<attribute name="end" />
<attribute name="property" />
<![CDATA[
var text = attributes.get("text");
var start = attributes.get("start");
var end = attributes.get("end") || text.length();
project.setProperty(attributes.get("property"), text.substring(start, end));
]]>
</scriptdef>
........
<target ...>
<substring text="asdfasdfasdf" start="2" end="10" property="subtext" />
<echo message="subtext = ${subtext}" />
</target>
</project>
这篇关于如何拉出来在蚂蚁一子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!