⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 validatefield.cs

📁 串口发送短信
💻 CS
字号:


namespace SMSTest
{
	using System;
	using System.Text.RegularExpressions;

	/// <summary>
	/// ValidateField 的摘要说明。
	/// </summary>
	public class ValidateField
	{
		//号码验证的正则表达式 11或14位数字
		private  const string REGEXPRISSON = @"(^\d{11}$)|(^\d{14}$)";

		public ValidateField()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}

		//字段是否为空
		public static bool IsNullField(string field)
		{
			return ((field == null) || (field == string.Empty));
		}
		//验证字段是否合法
		public static bool Validate(string field)
		{
			Regex reg = new Regex(REGEXPRISSON);

			return reg.IsMatch(field);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -