判斷是否十六進制格式字符串
阿新 • • 發佈:2017-08-02
octal -1 八進制 express 二進制 字符串 urn [0 判斷 return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN);
}
/// 判斷是否二進制格式字符串
public bool IsBinary(string str)
{
const string PATTERN = @"[0-1]+$";
return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN);
}
/// 判斷是否十進制格式字符串
public bool IsDecimal(string str)
{
const string PATTERN = @"[0-9]+$";
return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN);
}
/// 判斷是否十六進制格式字符串
public bool IsHexadecimal(string str)
{
const string PATTERN = @"[A-Fa-f0-9]+$";
return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN);
}
/// 判斷是否八進制格式字符串
public bool IsOctal(string str)
{
const string PATTERN = @"[0-7]+$";
}
/// 判斷是否二進制格式字符串
public bool IsBinary(string str)
{
const string PATTERN = @"[0-1]+$";
return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN);
}
/// 判斷是否十進制格式字符串
public bool IsDecimal(string str)
{
const string PATTERN = @"[0-9]+$";
return System.Text.RegularExpressions.Regex.IsMatch(str, PATTERN);
}
判斷是否十六進制格式字符串