예제 #1
0
 static bool IsOnlyDecimalDigits(string text)
 {
     // if text is null, return false.
     // Otherwise return true if ALL the characters are decimal digits,
     // or false is ANY ONE character isn't.
     return(text.IfNotNull(s => !s.Any(c => !JSScanner.IsDigit(c))));
 }
예제 #2
0
        private static bool IsOnlyDecimalDigits(string text)
        {
            // if text is null, return false.
            // Otherwise return true if ALL the characters are decimal digits,
            // or false is ANY ONE character isn't.
            //return text.IfNotNull(s => !s.Any(c => !JSScanner.IsDigit(c)));

            return(text.IfNotNull(s =>
            {
                foreach (char c in s)
                {
                    if (!JSScanner.IsDigit(c))
                    {
                        return false;
                    }
                }
                return true;
            }));
        }