C#判断字符串是否为数字

时间:2014-06-05 20:40:04   收藏:0   阅读:210

string i = Console.ReadLine();
            int a=0;
            if (int.TryParse(i, out a) == false) //判断是否可以转换为整型
            {
                Console.WriteLine("False");
            }
            else
            {
                Console.WriteLine("Ture");
            }
            Console.ReadLine();

C#判断字符串是否为数字,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!