[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 ...
随机推荐
- AS3 判断双击事件
//双击事件触发的时候不触发单击事件 package { import com.greensock.TweenLite; import flash.display.DisplayObjectConta ...
- 对类 sizeof
sizeof一个类的时候,都什么会被计算?静态成员会被计算进来么?如果这是一个子类,它的父类成员会被计算么? #include <iostream> using namespace std ...
- WCF 快速入门
定义服务契约 构建HelloWCF应用的第一步是创建服务契约.契约式是表示消息应用外形的主要方式.对于外形,是指服务暴露的操作,使用的消息 schema和每个操作实现的消息交换模式(MEP).总之,契 ...
- Spring整合Hibernate,Druid(Maven)
本文转载自:http://blog.csdn.net/lantazy/article/details/52495839 首先,说一下spring,spring有很好的整合能力,Web应用的各个层次都能 ...
- JVM体系结构之三:方法区之2(jdk1.6,jdk1.7,jdk1.8下的方法区变迁)
方法区 方法区存储虚拟机加载的类信息,常量,静态变量,即时编译器编译后的代码等数据.HotSpot中也称为永久代(Permanent Generation),(存储的是除了Java应用程序创建的对象之 ...
- UI“三重天”之selenium--封装(二)
基础示例代码: /** * @author Richered **/ package com.sample; import org.openqa.selenium.By; import org.ope ...
- 精《Linux内核精髓:精通Linux内核必会的75个绝技》一HACK #8 调度策略
HACK #8 调度策略 本节介绍Linux的调度策略(scheduling policy).Linux调度策略的类别大致可以分为TSS(Time Sharing System,分时系统)和实时系统这 ...
- 性能基准测试:KVM大战Xen
编译自:http://major.io/2014/06/22/performance-benchmarks-kvm-vs-xen/作者: Major Hayden原创:LCTT https://lin ...
- OpenMP 循环调度 + 计时
▶ 使用子句 schedule() 来调度循环,对于循环中每次迭代时间不相等的情况较为有效 ● 代码 #include <stdio.h> #include <stdlib.h> ...
- layui 弹框
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&q ...