C# 判断是否为数字

C# 判断是否为数字

            string a = "a123";
            if (a != null && Regex.IsMatch(a, @"^\d+$"))
            {
                Console.WriteLine("数字");
            }
            else
            {
                Console.WriteLine("不是数字");
            }
            Console.ReadLine();

 

posted @ 2021-11-09 10:14  我的未来方程式i  阅读(128)  评论(0编辑  收藏  举报