top of page

Groovy: Multi-line Strings

In Groovy there are three ways to define multi-line Strings

Method 1: Triple Quote def multiLineString = """Line 1 Line 2 Line 3""" Method 2 def multiLineString = new String( "Line 1" + "Line 2" + "Line 3")

Method 3 def multiLineString = "Line 1" + "Line 2" + "Line 3" Method 1 is the best and most true Groovy way of defining multi-line Strings in Groovy.

Is there any other way to define multi-line String in Groovy then please comment?

902 views0 comments

Recent Posts

See All

Grails & reCAPTCHA

What is reCAPTCHA? reCAPTCHA is a powerful service to detect against spam & abuse and can very easily help your distinguish between an actual site visitor or a bot. reCAPTCHA is a free service provide


bottom of page