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?
תגובות