C#正则验证字符串是否全是数字

Regex r = new Regex(@"^\d+$");
            if (r.Match(vlannumber).Success)
            {
                sql += " and a.vlannumber=" + vlannumber;
            }
            else
            {
                sql += " and a.memo like '%" + vlannumber + "%'";
            }

 

你可能感兴趣的:(C#正则验证字符串是否全是数字)