/// <summary> ///determine if the hexadecimal format string/// </summary> /// <param name= "str" ></param> /// <returns></returns> Public BOOLIshexadecimal (stringstr) { Const stringPATTERN =@"[a-fa-f0-9]+$"; returnSystem.Text.RegularExpressions.Regex.IsMatch (str, PATTERN); } /// <summary> ///determine if octal format string/// </summary> /// <param name= "str" ></param> /// <returns></returns> Public BOOLIsoctal (stringstr) { Const stringPATTERN =@"[0-7]+$"; returnSystem.Text.RegularExpressions.Regex.IsMatch (str, PATTERN); } /// <summary> ///determines whether a binary format string/// </summary> /// <param name= "str" ></param> /// <returns></returns> Public BOOLIsBinary (stringstr) { Const stringPATTERN =@"[0-1]+$"; returnSystem.Text.RegularExpressions.Regex.IsMatch (str, PATTERN); } /// <summary> ///determines whether the decimal format string/// </summary> /// <param name= "str" ></param> /// <returns></returns> Public BOOLIsdecimal (stringstr) { Const stringPATTERN =@"[0-9]+$"; returnSystem.Text.RegularExpressions.Regex.IsMatch (str, PATTERN); }
C # Determines whether a string conforms to a regular expression in hexadecimal, octal, binary, and decimal integer format