Felbook.Models.ValidationMethods.IsNumeric C# (CSharp) Method

IsNumeric() public method

public IsNumeric ( string s ) : bool
s string
return bool
        public bool IsNumeric(string s)
        {
            bool isnumeric = false;
            if (!IsEmptyString(s))
            {
                try
                {
                    System.Double.Parse(s, System.Globalization.NumberStyles.Any, null);
                    isnumeric = true;
                }
                catch
                {
                    isnumeric = false;
                }
            }
            else
            {
                isnumeric = false;
            }
            return isnumeric;
        }

Usage Example

示例#1
0
        public override bool IsValid(object value)
        {
            ValidationMethods valMethods = new ValidationMethods();
            if (value == null)
            {
                return true;
            }
            string stringICQ = (string)value;

            if (valMethods.IsNumeric(stringICQ) && stringICQ.Length > 6 && stringICQ.Length < 10)
            {
                return true;
            }
            else {
                return false;
            }
        }
All Usage Examples Of Felbook.Models.ValidationMethods::IsNumeric