String 如何在Groovy中将列表转换为字符串并删除括号而不使用replace?
因此,我有以下代码,其中我将一些元素添加到列表中,对它们进行排序,并作为字符串打印String 如何在Groovy中将列表转换为字符串并删除括号而不使用replace?,string,groovy,String,Groovy,因此,我有以下代码,其中我将一些元素添加到列表中,对它们进行排序,并作为字符串打印 def officeWorkers = [] officeWorkers << "Jim Halpert" officeWorkers << "Dwight Shrute" officeWorkers << "Toby Flenderson" officeWorkers.sort() println("I wish my co workers were ${offi
def officeWorkers = []
officeWorkers << "Jim Halpert"
officeWorkers << "Dwight Shrute"
officeWorkers << "Toby Flenderson"
officeWorkers.sort()
println("I wish my co workers were ${officeWorkers.toString()}")
def officeWorkers=[]
公务员使用加入:
println("I wish my co workers were ${officeWorkers.join(', ')}")