[Training Video - 4] [Groovy] String Functions
def x="I like to read books before bed"
def temp = x.split(" ")
log.info "Size of array is : "+temp.length
log.info temp[0]
log.info temp[1]
log.info x.substring(2,8)
log.info x.indexOf("t")
log.info x.indexOf("book")
log.info x.indexOf("e",6)
log.info x.charAt(5)
Result:
Tue Jun 16 14:40:49 CST 2015:INFO:Size of array is : 7
Tue Jun 16 14:40:49 CST 2015:INFO:I
Tue Jun 16 14:40:49 CST 2015:INFO:like
Tue Jun 16 14:40:49 CST 2015:INFO:like t
Tue Jun 16 14:40:49 CST 2015:INFO:7
Tue Jun 16 14:40:49 CST 2015:INFO:15
Tue Jun 16 14:40:49 CST 2015:INFO:11
Tue Jun 16 14:40:49 CST 2015:INFO:e
def a = "100"
def b = "200" def c = Integer.parseInt(a) + Integer.parseInt(b)
log.info "sum = " + c def d = 100
def n = String.valueOf(d)
log.info "d = " + d
Result:
Tue Jun 16 14:45:55 CST 2015:INFO:sum = 300
Tue Jun 16 14:45:55 CST 2015:INFO:d = 100
[Training Video - 4] [Groovy] String Functions的更多相关文章
- [Training Video - 3] [Groovy in Detail] Non-static and Static functions, initializing log inside class
log.info "starting" // we use class to create objects of a class Planet p1 = new Planet() ...
- [Training Video - 2] [Groovy Introduction]
Building test suites, Test cases and Test steps in SOAP UI Levels : test step level test case level ...
- [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Exception Handling in groovy
def x = new String[3] x[0] = "A" x[1] = "B" x[2] = "C" log.info"X ...
- [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Array and ArrayList
Array: def x = new String[5] x[0] = "India" x[1] = "USA" x[2] = "Korea" ...
- [Training Video - 4] [Groovy] Optional parameter in groovy
Employee.log=log Employee e1 = new Employee() log.info e1.add(1,2,3,4) // optional parameters in gro ...
- [Training Video - 3] [Groovy in Detail] Non-static and Static variables, objects and object referances
log.info "starting" // we use class to create objects of a class Planet p1 = new Planet() ...
- [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] HashSet and Hashtable
Hashset: HashSet set = new HashSet() set.add("India") set.add("USA") set.add(&qu ...
- [Training Video - 4] [Groovy] Object equality and variable equality check
def x=2 def y=3 if(x == y){ log.info "equal" }else{ log.info "not equal" // prin ...
- [Training Video - 4] [Groovy] Initializing log inside class with constructor
TestService s = new TestService(log,context,testRunner) s.xyz() class TestService{ def log def conte ...
随机推荐
- Promise的并行和串行
Promise 并行 这个功能Promise自身已经提供,不是本文的重点.主要是依赖Promise.all和Promise.race. Promise.all是所有的Promise执行完毕后(reje ...
- Armadillo安装及使用
以下转载自http://www.cnblogs.com/youthlion/archive/2012/05/15/2501465.html Armadillo是一个C++开发的线性代数库,在vs201 ...
- HDU 4825 字典树
HDU 4825 对于给定的查询(一个整数),求集合中和他异或值最大的值是多少 按位从高位往低位建树,查询时先将查询取反,然后从高位往低位在树上匹配,可以匹配不可以匹配都走同一条边(匹配表示有一个异或 ...
- php 数据类型转换与比较
<?php define("PI", 3.1415926); echo PI."<br>"; //定义一个常量 define("GR ...
- C#使用OpcNetApi.dll和OpcNetApi.Com.dll操作OPC
本人学习了一下.Net,恰好,51自学网,又要用这个.而网上很多VC6,VB6,VB .Net的但,很少C#的.现在研究一下,给出例子: 测试平台,是VS2008,KEPServer,OpcNetAp ...
- Java集合类综合
Java集合类是JDK学习中的一个经典切入点,也是让初学者最初感受到Java魅力的地方之一,你一定不会忘记不需要关心大小的ArrayList,不用自己实现的Queue,和随处可见的HashMap.面试 ...
- C#调用Oracle带输出数据集的存储过程
1.创建一个带输出数据集的Oracle存储过程 create or replace procedure PRO_test(in_top in number,cur_out out sys_refcur ...
- js事件监听机制(事件捕获)
在前端开发过程中我们经常会遇到给页面元素添加事件的问题,添加事件的js方法也很多,有直接加到页面结构上的,有使用一些js事件监听的方法,由于各个浏览器对事件冒泡事件监听的机制不同,le浏览器只有事件冒 ...
- SPM——How to use github
In this semester, we take a class called 'Software Project Management'. And in this class, we have l ...
- OpenCL 图像卷积 1
▶ 书上的代码改进而成,从文件读入一张 256 阶灰度图,按照给定的卷积窗口计算卷积,并输出到文件中. ● 代码,使用 9 格的均值窗口,居然硬读写 .bmp 文件,算是了解一下该文件的具体格式,留作 ...