-3

假设您有来自电子邮件应用程序的一串抄送电子邮件地址,例如

你好@test.com; 你好@test.co.uk; hi@test.com;

如何将它们分成单独的字符串?

4

2 回答 2

3
emailAddresses.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); 
于 2013-08-07T08:44:09.233 回答
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);
}

高温高压

于 2013-08-07T08:46:31.433 回答