public static String removeDuplicate(String str ,String symbol){
String result = null;
try {
if(StringUtils.hasText(str) && (symbol != null) ){
if(str.indexOf(symbol) >= 0){
String[] strs = str.split(symbol);
for(int i=0;i<strs.length;i++){
boolean isDuplicate = true;
for(int j=i+1;j<strs.length;j++){
if(strs[i].equals(strs[j])){
isDuplicate = false;
}
}
if(isDuplicate){
if( result == null){
result = strs[i];
}else{
result =result+symbol+ strs[i];
}
}
}
}else {
result = str;
}
}else {
result = str;
}
} catch (Exception e) {
result = str;
throw new RuntimeException(e);
}
return result;
}
邮件收件人去重 (aaa@qq.com;bbb@qq.com;aaa@qq.com)
最新推荐文章于 2024-11-05 17:49:14 发布