examples/groovy/join_elements.groovy


def names = ['Foo', 'Bar', 'Zorg']

def names_str = names.join('-')
println(names_str)

println( names.join(' ') )

println( names.join('\n') )

The output is:

examples/groovy/join_elements.txt

Foo-Bar-Zorg
Foo Bar Zorg
Foo
Bar
Zorg