for (int t = 0; t < memberLen; t++) {
memTemp = stafferMap.get(strMember[t]);
if(memTemp != null){
memberNames += memTemp + ",";
}
}
以上的代码,拼接的字符串会多一个“,”,比如:"str1,str2,str3,",要去除str3后的逗号,可用如下方法:
memberNames = memberNames.substring(0,memberNames.length()-1);
比如当Team1=test ', 'U1-Team ', 'V-Team ', '时
如何改成:
Team1= 'test ', 'U1-Team ', 'V-Team '
可用:
Team1 = " ' " + Team1.Substring(0, Team1.Length - 2);