[Ant][StartWithAnt] 第五章 条件判断Contidion 3.字符串匹配
来源:互联网 发布:网络运营部职责 编辑:程序博客网 时间:2024/04/28 17:24
点击此处下载StartWithAnt完整的pdf文档与代码:http://download.csdn.net/detail/sodino/6603769
可以使用equals任务来判断两个给定的字符串内容是否相同。equals任务重要的属性说明如下:
arg1/arg2:指定两个用来对比的字符串,这两个参数必须有被赋值。
casesensitive:设定在匹配过程中是否区分大小写,默认值为true区分大小写。
trim:在匹配过程中是否去除空格再比较。默认为false。
可以使用contains任务来判断能否在指定的字符串中搜索出另一个字符串。contains任务只有三个属性:
string:指定被搜索的字符串。
substring:指定搜索的字符串。
casesensitive:是否区分大小写。默认为true区分大小写。
下面给出示例代码:
<property name="Apple" value="Apple"/><property name="string.a" value="I'm a red ${Apple}"/><property name="string.b" value="I'm a flying Bee"/><condition property="a.equals.b" value="true" else="false"><equals arg1="${string.a}" arg2="${string.b}"/></condition><condition property="isContains" value="true" else="false"><contains string="${string.a}" substring="${Apple}"/></condition><target name="Condition"><echo message="string.a equals string.b: ${a.equals.b}"/><echo message="string.a contains Apple: ${isContains}"/></target>
代码5.6 字符串匹配
图5.2 字符串匹配结果
- [Ant][StartWithAnt] 第五章 条件判断Contidion 3.字符串匹配
- [Ant][StartWithAnt] 第五章 条件判断Contidion 1.逻辑判断
- [Ant][StartWithAnt] 第五章 条件判断Contidion 4.文件内容匹配 5.特性(property)存在性判断
- [Ant][StartWithAnt] 第五章 条件判断Contidion 2.资源存在性判断
- [Ant][StartWithAnt] 第二章 Ant基础知识准备
- [Ant][StartWithAnt] 第三章 特性property
- [Ant][StartWithAnt] 第四章 时间戳tstamp
- [Ant][StartWithAnt] 第六章 数据类型Data Type
- [Ant][StartWithAnt] 第三章 特性property
- Ant 条件判断 condition
- ANT条件判断
- Ant 条件判断 condition
- ant 条件判断语法
- ant 条件判断语法
- ant 条件判断 condition
- ant 条件判断 condition
- Ant 条件判断 if
- Ant 条件判断 if
- [Ant][StartWithAnt] 第五章 条件判断Contidion 2.资源存在性判断
- WPF之按键事件
- Altium Designer PCB中单独添加一个元器件的封装(原理图遗忘某个元器件时使用)
- uiscrollView 原理详解
- [Android开发实战]Android添加快捷方式到桌面的两种方式
- [Ant][StartWithAnt] 第五章 条件判断Contidion 3.字符串匹配
- Hive Cli
- VS2010 Cocos2d-x 2.2创建模板
- ZOJ 3736 Pocket Cube(暴力,魔方)
- 手动给Qt creator添加工具链和编译器
- JAVA Swing异或图形模式
- C++ 数据转换总结
- 百度ueditor not import language file
- LeetCode 3Sum 三个数和为零的集合 C++完整程序