12、字符串 
(1)基本用法 
l         Groovy中的字符串允许使用双引号和单引号 
println "he said 'cheese' once" println 'he said "cheese!" again'  
l         Groovy支持\uXXXX引用(其中X是16进制数),用来表示特殊字符,例如\u0040与@字符相同 
(2)多行字符串 
l         Groovy中的字符串可以分成多行 
foo = "hello  there   how are things?" println(foo)  
(3)Here-docs 
l         如果有一大块文本(如HTML的)不想编码,你可以使用Here-docs 
name = "James" text = <<<FOO hello there ${name}how are you today? FOO assert text != null println(text)  
(4)GString 
l         使用${expression}语法,可以在字符串中包含任意的表达式,类似于JSP EL、Velocity 
l         任何有效的Groovy表达式都能够使用${...}包含到方法调用中 
l         使用包含${expression}的字符串时,CString对象就会被创建,以包含在字符串中使用的文本和值 
l         CString使用惰性求值方式,只有在调用toString()方法时才会求值  
 
  |