Groovy - for mutli-line字符串中的循环?

时间:2017-10-29 00:28:31

标签: groovy

如何循环遍历值列表,包括每个值到Groovy多行字符串?

实施例

myList = ['one', 'two', 'three']
myString = """
           some text
           ${for(item in myList){item}}
           some more text
           """

1 个答案:

答案 0 :(得分:1)

使用static void main(String[] args) { def myList = ['one', 'two', 'three'] def myString = """ some text ${myList.join()} some more text """ println myString }

//a[contains(.,'6017785')]