在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
/// <summary> /// 判断是否十六进制格式字符串 /// </summary> /// <param name="str"></param> /// <returns></returns> public bool IsHexadecimal(string str) { const string PATTERN = @"[A-Fa-f0-9]+$"; return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN); } /// <summary> /// 判断是否八进制格式字符串 /// </summary> /// <param name="str"></param> /// <returns></returns> public bool IsOctal(string str) { const string PATTERN = @"[0-7]+$"; return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN); } /// <summary> /// 判断是否二进制格式字符串 /// </summary> /// <param name="str"></param> /// <returns></returns> public bool IsBinary(string str) { const string PATTERN = @"[0-1]+$"; return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN); } /// <summary> /// 判断是否十进制格式字符串 /// </summary> /// <param name="str"></param> /// <returns></returns> public bool IsDecimal(string str) { const string PATTERN = @"[0-9]+$"; return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN); }
|
请发表评论