You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Common.Helper
|
|
|
|
|
{
|
|
|
|
|
public static class MailAddrSplitDistinctHelper
|
|
|
|
|
{
|
|
|
|
|
public static List<string> SplitDistinct(List<string> list)
|
|
|
|
|
{
|
|
|
|
|
HashSet<string> hs = new HashSet<string>();
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
if (item.Contains(";"))
|
|
|
|
|
{
|
|
|
|
|
var arr = item.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
foreach (var ss in arr)
|
|
|
|
|
{
|
|
|
|
|
hs.Add(ss);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (item.Contains(","))
|
|
|
|
|
{
|
|
|
|
|
var arr = item.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
foreach (var ss in arr)
|
|
|
|
|
{
|
|
|
|
|
hs.Add(ss);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
hs.Add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hs.ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|