字符串
作者:
龙剑灵 | 来源:发表于
2020-03-15 22:58 被阅读0次def str = "groovy"
println str.center(8)
println str.center(7, "+") //groovy+
println str.center(8, "+") //+groovy+
println str.padLeft(8, "+") //++groovy
println str.padRight(8, "+") //groovy++
def str2 = 'hello'
str = "groovy hello"
println str > str2 //false
println str[1]
println str[0..3] //groo
println str.minus(str2) //groovy
println str- str2 //groovy
println str.reverse() //olleh yvoorg
println str.capitalize() //Groovy hello
本文标题:字符串
本文链接:https://www.haomeiwen.com/subject/gixbdhtx.html
网友评论