论坛首页 入门讨论版 .net

NET用正则表达式判断字符串长度必须为多长

浏览 303 次
该帖已经被评为新手帖
作者 正文
最后更新时间:2008-04-03
//--------------------Check the IMEI's format which Must be 15  figure----------------

Regex reg=new Regex(@"^\d{15}$",RegexOptions.None);
if(!reg.IsMatch(this.textBoxIMEI.Text))
{
  labelStatus.Text="IMEI 格式有誤!";
  labelStatus.ForeColor=Color.Red;
  return;
}
   
论坛首页 入门讨论版 .net

跳转论坛:
JavaEye推荐