Beispiel #1
0
 public static bool IsUnsignedDecimalValue(string value)
 {
     if (string.IsNullOrEmpty(value))
     {
         return(false);
     }
     return(StringValidator.IsPositiveDecimalDigit(value.First()) &&
            value.Skip(1).All(StringValidator.IsDecimalDigit));
 }
Beispiel #2
0
        public static bool IsDecimalValue(string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(false);
            }
            var chars = value.AsEnumerable();

            if (new[] { '+', '-' }.Contains(chars.First()))
            {
                chars = chars.Skip(1);
            }
            return(StringValidator.IsPositiveDecimalDigit(chars.First()) &&
                   chars.Skip(1).All(StringValidator.IsDecimalDigit));
        }
Beispiel #3
0
        // realValue = ["+" / "-"] * decimalDigit "." 1*decimalDigit
        //             [ ("e" / "E") [ "+" / "-" ] 1*decimalDigit ]

        #region decimalDigit = "0" / positiveDecimalDigit

        public static bool IsDecimalDigit(char value)
        {
            return((value == '0') || StringValidator.IsPositiveDecimalDigit(value));
        }