我怎样才能比较数值两个属性? [英] How can I compare two properties with numeric values?

查看:126
本文介绍了我怎样才能比较数值两个属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何才能找到这两个数值的属性是最大的?

下面是检查wheather两者是平等的:

 <条件属性=isEqual:方法>
    &所述;等于ARG1 =1ARG2 =2/>
< /条件>


解决方案

蚂蚁脚本任务允许你实现脚本语言的任务。如果你已经安装了JDK 1.6,Ant可以无需任何额外的依赖库执行JavaScript。例如,这段JavaScript读取一个Ant属性值,然后设置根据条件另一个Ant属性:

 <属性名=版本值=2/><目标名称=初始化>
  < SCRIPT LANGUAGE =JavaScript的><![CDATA [
    VAR的版本= parseInt函数(project.getProperty('版本'));
    project.setProperty('isGreater',版本大于1);
  ]]>< / SCRIPT>  <回声消息=$ {} isGreater/>
< /目标与GT;

How can I find out which of two numeric properties is the greatest?

Here's how to check wheather two are equal:

<condition property="isEqual">
    <equals arg1="1" arg2="2"/>
</condition>

解决方案

The Ant script task allows you to implement a task in a scripting language. If you have JDK 1.6 installed, Ant can execute JavaScript without needing any additional dependent libraries. For example, this JavaScript reads an Ant property value and then sets another Ant property depending on a condition:

<property name="version" value="2"/>

<target name="init">
  <script language="javascript"><![CDATA[
    var version = parseInt(project.getProperty('version'));
    project.setProperty('isGreater', version > 1);
  ]]></script>

  <echo message="${isGreater}"/>
</target>

这篇关于我怎样才能比较数值两个属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆