[Training Video - 4] [Groovy] String Functions
2015-06-16 14:42
441 查看
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
相关文章推荐
- 如何允许你的应用移动到SD卡?(转至http://blog.csdn.net/feng88724/article/details/6946670)
- view controller container
- 安装mac os x时about a second remaining解决方法
- How-to: Enbale HMaster HA(high availability) and High Available Reads
- /dev/sda2 contains a file system with errors ,check forced
- 安装apk时报错:INSTALL_FAILED_INVALID_URI解决办法
- SVN 更新 报错 containing working copy admin area is missing
- SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
- FairSync与NonFairSync比较
- Leetcode36: Contains Duplicate II
- Foxmail登陆gmail设置
- WIZnet将参展2015年深圳MakerFaire制汇节!
- ArrayList的contains方法
- DB2中生成EXPLAIN table并导出explain plan
- Opencontrail的git库
- httpd: Could not reliably determine the server's fully qualified domain name
- Contains Duplicate
- ZOJ 1094 Matrix Chain Multiplication
- Factorial Trailing Zeroes
- main函数参数详解