是否数字(包括-、.) - IsNumeric

2017-05-03 21:25:28  访问(1560) 赞(0) 踩(0)


        /// <summary>
        /// 是否数字(包括-、.) - IsNumeric
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool IsNumeric(string str)
        {
            if (str == null || str.Length == 0)
                return false;

            System.Text.RegularExpressions.Regex
                reg1 =
                    new System.Text.RegularExpressions.Regex(@"^[-]?\d+[.]?\d*$");

            return reg1.IsMatch(str);
        }


标签:是否数字(包括-、.) - IsNumeric 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)