Groovy web console

subscribe to the feed Subscribe
to this

02 More Strings

Published 2 months ago by ST with tags groovy
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
//GStrings (double quotes) support interpolation

// Interpolation is the act of replacing a placeholder in a string with a 
// value when the string is evaluated. A placeholder is surrounded by ${}
// or prefixed with $.

def name = 'World'
println "Hello $name"

// There are also multi-line strings
def text = '''This is a long text that
spans multiple lines.'''

// ... and GStrings

name = 'user'
text = """Hello $name!