def names =开发者_C百科 ["myname", "yourname", "theirname", "allnames"]
String n = ""
names.each{
n += it + ","
}
println n
Output:
myname,yourname,theirname,allnames,
How do I get rid of the trailing comma?
names.join(",")
def names =开发者_C百科 ["myname", "yourname", "theirname", "allnames"]
String n = ""
names.each{
n += it + ","
}
println n
Output:
myname,yourname,theirname,allnames,
How do I get rid of the trailing comma?
names.join(",")
上一篇:意外保险一年大概要多少钱??
精彩评论