Asp.net 判断输入的字符串是不是数字

/// <summary>

    /// 判断输入的字符串全是字符不包括数字,不是返回false,否则返回true 20100728

    /// </summary>

    /// <param name="text"></param>

    /// <returns></returns>

    public static bool IsChar(string text)  //http://wenwen.soso.com/z/q120543222.htm

    {

        int count = 0;

        for (int i = 0; i < text.Length; i++)

        {

            if (!Char.IsNumber(text, i)) //不是数字

            {

                count++;

            }

        }

        if (count == text.Length)

        {

            return true;  //输入全是字符,不包括数字

        }

        else

        {

            return false;  //否则是数字

        }

    }

 

出自:http://blog.csdn.net/dingdangxiaoma/article/details/5774466

原文地址:https://www.cnblogs.com/chenyuwang2009/p/2820864.html