dlexia
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string email = Console.ReadLine();
                if (email.Contains("@") && (email.Contains(".com") || email.Contains(".cn")))//是否包括@、.com、.cn
                {
                    int index = email.IndexOf("@");//IndexOf查找“@”在第几个下标
                    Console.WriteLine("您输入的邮箱正确!");
                    Console.WriteLine("您的邮箱用户名为:" + email.Substring(0, index));
                }
                else
                {
                    Console.WriteLine("您输入的邮箱不正确!");
                }
            }
          

        }
    }
}

 

分类:

技术点:

相关文章:

  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2021-09-04
  • 2021-04-25
  • 2021-11-21
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2021-11-21
相关资源
相似解决方案