static void Main(string[] args)
{
while (true)
{
string email = Console.ReadLine();
if (email.Contains("@") && (email.Contains(".com") || email.Contains(".cn")))
{
int index = email.IndexOf("@");
Console.WriteLine("您输入的邮箱正确!");
Console.WriteLine("您的邮箱用户名为:"+email.Substring(0,index));
}
else
{
Console.WriteLine("您输入的邮箱不正确!");
}
}
}
时间: 2024-11-07 12:15:29