C#
//去掉最末尾的一个字符
sb.ToString().TrimEnd(',')
//连接一个字符串数组
string[] arr = new string[]{"nihao","en","dajiahao"}
string st = string.Join("-",arr)
结果: nihao-en-dajiahao