首页 > Windows开发 > 详细

WPF 输入框正则效验

时间:2020-04-07 19:40:14      阅读:79      评论:0      收藏:0      [点我收藏+]
原文:WPF 输入框正则效验

1.

if (!TelphoneHelper2.IsTelphone(mobile)
{
MessageBox.Show("请录入正确的手机号!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}

2.TelphoneHelper2.cs

1
2
3
4
5
6
7
8
9
10
public class TelphoneHelper2
   {
       public static bool IsTelphone(string tel)
       {
           String strExp = @"[0-9][0-9][0-9]{9}";
           Regex r = new Regex(strExp);
           Match m = r.Match(tel);
           return m.Success;
       }
   }

  

WPF 输入框正则效验

原文:https://www.cnblogs.com/lonelyxmas/p/12655030.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!