Groovy(二)

Groovy(二)基础

String

创建字符串字面常量

通过Groovy将''定义的类型认定为String

println "-----------------String---------------"
def tStr = "hello word";
println 'hello word'.class
char tChar = 'c'
println tChar.class

Groovy(二)

多行字符串

减少连接符和转义字符的使用

sb = new StringBuffer()
sb.append('''
^    ^
 ____
''')
println sb

Groovy(二)

上一篇:Groovy


下一篇:02-Groovy-IntelliJ IDEA配置Groovy开发环境