日期:2014-05-17 浏览次数:20503 次
List<string> listMails = new List<string>();
for (int i = 0; i < matches.Count; i++)
//在输入字符串中找到所有匹配
{
if (!listMails.Contains(matches[i].Value))
{
listMails.Add(matches[i].Value);
_emailcontainer += matches[i].Value + ";";
}
}
------解决方案--------------------
string str = "a@aa.com,b@bb.com,a@aa.com,c@cc.com,b@bb.com" + ",";
Regex reg = new Regex(@"(([^,\s]+?@[^,\s]+?,).*?)\2");
while (str != (str = reg.Replace(str, "$1"))) ;
Console.WriteLine(str.Trim(','));
Console.ReadLine();
//a@aa.com,b@bb.com,c@cc.com