我有一个ant属性,其值为abcdefghijklmn
我想从属性中删除最后三个字符到abcdefghijk。
请帮忙。
答案 0 :(得分:0)
build:
[echo] x = abcdefghijklmn
[echo] y = abcdefghijk
<project name="demo" default="build">
<property name="x" value="abcdefghijklmn"/>
<target name="build">
<script language="javascript">
project.setProperty("y", project.getProperty("x").substr(0,11));
</script>
<echo message="x = ${x}"/>
<echo message="y = ${y}"/>
</target>
</project>