def names = ["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(",")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With