假设您有来自电子邮件应用程序的一串抄送电子邮件地址,例如
你好@test.com; 你好@test.co.uk; hi@test.com;
如何将它们分成单独的字符串?
emailAddresses.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
您可以使用字符串的拆分功能:
string cc = "hello@test.com; hello@test.co.uk; hi@test.com;";
string[] emails = cc.Split(';');
foreach (string email in emails)
{
Console.WriteLine(email);
}
高温高压