博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Groovy脚本-正则表达式
阅读量:4282 次
发布时间:2019-05-27

本文共 554 字,大约阅读时间需要 1 分钟。

1.字符串处理 

def str = "groovy"

println str[4]    //打印v 同getAt(4)

println str[1..-1]  //打印roovy -1表示最后一位

println str[4..2]  //打印voo 反向

println str[4,1,2]  //打印vro

println str.length() //打印6 同Java

println str.endsWith("ovy")  //true

更多:http://blog.csdn.net/u013803499/article/details/54616278

2.正则表达式

println “switch32”=~'^switch' //打印true ^匹配开头

. $ *等

更多:http://www.360doc.com/content/12/1127/07/820209_250456233.shtml

http://364434006.iteye.com/blog/1735462

http://blog.csdn.net/u011054333/article/details/60471910

http://blog.csdn.net/zdnlp/article/details/8013795

你可能感兴趣的文章
hdu - 2512 一卡通大冒险 (斯特灵数 && 贝尔数)
查看>>
1951: [Sdoi2010]古代猪文
查看>>
hdu-3625 Examining the Rooms(斯特灵数第一类)
查看>>
hdu-4045 Machine scheduling
查看>>
codeforces 483B Friends and Presents
查看>>
URAL 1091. Tmutarakan Exams
查看>>
UVa 10844 (大数)
查看>>
poj - 2356 Find a multiple
查看>>
hdu-1796
查看>>
codeforces Lucky Sum
查看>>
Ural 1207. Median on the Plane(计算几何)
查看>>
hdu-1392 Surround the Trees && poj Rope (简单凸包)
查看>>
hdu-You can Solve a Geometry Problem too
查看>>
poj 2187 Beauty Contest
查看>>
计算几何
查看>>
hdu-2204 Eddy's爱好 && nyoj 526
查看>>
zoj-3802-Easy 2048 Again
查看>>
CodeForces 459C(构造题)
查看>>
js初学笔记(一)
查看>>
js初学笔记(二)
查看>>