BellevueCollege.Toolkit.IsExpectedNumber C# (CSharp) Метод

IsExpectedNumber() публичный статический Метод

public static IsExpectedNumber ( string strValue, int intAllowedPrecision ) : bool
strValue string
intAllowedPrecision int
Результат bool
        public static bool IsExpectedNumber(string strValue, int intAllowedPrecision)
        {
            if (string.IsNullOrEmpty(strValue))
            {
                return false;
            }
            else if (intAllowedPrecision == 0)
            {
                return Regex.IsMatch(strValue, "^d{0,3}");
            }
            else
            {
                return Regex.IsMatch(strValue, "^\\d{0,3}(\\.\\d{1," + intAllowedPrecision.ToString() + "})?$");
            }
        }