验证字符串是否为数字

static bool IsNumeric(string str)
{
            if (str == null || str.Length == 0)
                return false;
            foreach (char c in str)
            {
                if (!Char.IsNumber(c))
                {
                    return false;
                }
            }
            return true;
        }

posted @ 2012-05-29 20:59  刘振明  阅读(157)  评论(0编辑  收藏  举报