12, string
(1) Basic usage
l Groovy strings allow for dual quotes and single quotes
Println "He Said 'Cheese' Once"
Println 'He Said "Cheese!" Again'
l Groovy Support / UXXXX reference (where x is a 16-based number), used to represent special characters, such as / u0040 is the same as @ characters
(2) Multi-line string
l Groovy strings can be divided into multiple lines
Foo = "Hello
there
How Are Things? "
Println (foo)
(3) Here-Docs
l If there is a large piece of text (such as HTML) does not want to encode, you can use Here-Docs
Name = "james"
Text = <<< foo
Hello there $ {name}
How are you today?
Foo
askERT TEXT! = NULL
Println (Text)
(4) gstring
l Use $ {expression} syntax, you can include any expression in the string, similar to JSP EL, Velocity
l Any valid Groovy expression can be included in the method call using $ {...}
l When using a string containing $ {expression}, the CString object is created to include the text and value used in a string.
l CString uses an inert evaluation method, only if you call the toString () method