在这里插入代码片
public static String spilt(String str) {
StringBuffer sb = new StringBuffer();
String[] temp = str.split(",");
for (int i = 0; i < temp.length; i++) {
if (!"".equals(temp[i]) && temp[i] != null) {
sb.append("'" + temp[i] + "',");
}
}
String result = sb.toString();
String tp = result.substring(result.length() - 1, result.length());
if (",".equals(tp)) {
return result.substring(0, result.length() - 1);
}else {
return result;
}
}
类名.split(要替换的字符串名称)
2.字符串替换“
String.replaceAll(“”“,”")