假设您有来自电子邮件应用程序的一串Cc电子邮件地址,例如
hello@test.com; hello@test.co.uk; hi@test.com;
如何将这些分隔成单独的字符串?
答案 0 :(得分:3)
emailAddresses.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
答案 1 :(得分:2)
你可以使用字符串的分割功能:
string cc = "hello@test.com; hello@test.co.uk; hi@test.com;";
string[] emails = cc.Split(';');
foreach (string email in emails)
{
Console.WriteLine(email);
}
HTH