使用正则表达式验证字母

实现效果:

  

知识运用:

  

实现代码:

        static void Main(string[] args)
        {
            Console.Title = "使用正则表达式验证字母";
            Console.WriteLine("开始输入,回车验证:\n");
            if(System.Text.RegularExpressions.Regex.IsMatch(Console.ReadLine(),"[a-zA-Z]"))
                Console.WriteLine("====【通过】====");
            else
                Console.WriteLine("====【失败!】====");
        }

猜你喜欢

转载自www.cnblogs.com/feiyucha/p/10046025.html
今日推荐