[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 ...
随机推荐
- [agc23E]Inversions
Atcoder description 给你\(n\)和\(\{a_i\}\),你需要求所有满足\(p_i\le a_i\)的\(1-n\)排列的逆序对个数之和模\(10^9+7\). \(n \le ...
- hasura graphql server (haskell)构建
安装 &&运行pg(docker) version: '3.6' services: postgres: image: postgres environment: - "PO ...
- String.valueof;和String = ""+1;的区别
关于字符串的+操作,单纯的String s ="" +11;编译器会看做常量""和常量11的拼接操作,常量计算最快:String.valueOf会调用方法,速 ...
- stacks and queues--codility
lesson 7: stacks and queues 1. Nesting 2. StoneWall 3. Brackets 4. Finsh lesson 7: stacks and queues ...
- oracle行跟踪(基于行跟踪的ROWDEPENDENCIES ORA_ROWSCN信息)
在Oracle 10g中的引入了ORA_ROWSCN伪列新特性.基于此种伪列所提供的信息,我们可以方便地找出某个数据块或某一个行最近被修改的时间戳.在默认情况下,10g下表会以非行依赖性(NOROWD ...
- RK3288 红外遥控器增加系统中已有的键值
转载请注明出处:https://www.cnblogs.com/lialong1st/p/10066673.html CPU:RK3288 系统:Android 5.1 1.查看遥控器的用户码和键值, ...
- 微信小程序详解——页面之间的跳转方式【路由】和参数传递
微信小程序拥有web网页和Application共同的特征,我们的页面都不是孤立存在的,而是通过和其他页面进行交互,来共同完成系统的功能.今天我们来研究小程序页面之间的跳转方式. 1.先导 在Andr ...
- java操作word报错及解决办法
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jacob-1.17-x86 in java.libra ...
- 黄聪:利用iframe实现ajax 跨域通信的解决方案(转)
原文:http://www.cnblogs.com/xueming/archive/2013/02/01/crossdomainajax.html 在漫长的前端开发旅途上,无可避免的会接触到ajax, ...
- shred_linux_unix
Sometimes you need to destroy or wipe data from hard drives (for example, before you sell your old h ...