English 中文(简体)
如何在安字母中增加特性数据类型?
原标题:How to increment character data type in Ant script?
  • 时间:2011-11-15 07:07:09
  •  标签:
  • ant

例:

<project name="num" default="jav">
  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  <!-- IF and Conditional task inbuild taskdef  --> 

  <target name="jav">
    <property file="proper.properties"/>
    <math result="index" operand1="${index}"
       operation="+" operand2="1" datatype="int"/>
    <echo message="index=${index}"/>
    <echo file="proper.properties" message="index=${index}"/> 
  </target>
</project> 

在<编码>proper.properties上,我有index=1A。 I m 能够增加编造部分,但并非特性部分。

页: 1 我想在每个建筑过程之后增加这一数字。

附录一已经做了第一次建筑工程,因此应为<代码>=2B。 这就是说,我希望在安字母中增加分类和特性价值(,2B,3C,......)。

能否在安特区这样做?

最佳回答

你们可以使用这样的东西:

<project name="test" default="init">

    <property name="init.value" value="1A"/>

    <scriptdef name="increase.label" language="javascript">
        <attribute name="value" />
        <attribute name="property" />
        <![CDATA[
       var initVal = attributes.get("value");
             var finalVal = String.fromCharCode(initVal.charAt(0) + 1);

       for(i = 1; i < initVal.length(); i++)
             {
               finalVal = finalVal.concat(String.fromCharCode(initVal.charAt(i) + 1));
             }
       project.setProperty(attributes.get("property"), finalVal);
     ]]>
    </scriptdef>


    <target name="init">
        <increase.label value="1A" property="result"/>
        <echo message="Result is : ${result}"/>
    </target>

</project>

你们当然需要 j1.6。

产出:

init:
     [echo] Result is : 2B

Edit :

现在,你们想要增加数量而不是增加。 使用<代码>parseInt (string, radix)。

I am not sure what you want to do with letters though. There you will have to add a new letter.

问题回答

暂无回答




相关问题
i want to continously run my java threads

I am running my java application where i have used threads... i am running this application using ant command on the terminal.. But when i close my terminal or press ctrl+c,then java program which was ...

Subant targets instead of ant

I m having a problem with subant and have no ideas any more. Can anyone help? Using Ant to replace some strings for other (i.e Productname and Version for "Foo" and "1.2") I used ...

java ant buildfile for project with dependencies

I am new to ant, but am trying to create an ant script that builds my current proeject with another project as a dependency. I have the ant script building my current project, but am unsure how to add ...

Building Apache Hive - impossible to resolve dependencies

I am trying out the Apache Hive as per http://wiki.apache.org/hadoop/Hive/GettingStarted and am getting this error from Ivy: Downloaded file size doesn t match expected Content Length for http://...

Ivy, ant and start scripts

I have a project that uses ant to build and ivy for dependencies. I would like to generate the start scripts for my project, with the classpath, based on the dependencies configured in Ivy, ...

热门标签