System.Number.TrailingZeros C# (CSharp) Method

TrailingZeros() private static method

private static TrailingZeros ( String s, Int32 index ) : Boolean
s String
index Int32
return Boolean
        private static Boolean TrailingZeros(String s, Int32 index) {
            // For compatability, we need to allow trailing zeros at the end of a number string
            for (int i = index; i < s.Length; i++) {
                if (s[i] != '\0') {
                    return false;
                }
            }
            return true;
        }

Usage Example

示例#1
0
        private static unsafe void StringToNumber(string str, NumberStyles options, ref Number.NumberBuffer number, NumberFormatInfo info, bool parseDecimal)
        {
            if (str == null)
            {
                throw new ArgumentNullException("String");
            }
            string str1  = str;
            char * chPtr = (char *)str1;

            if ((IntPtr)chPtr != IntPtr.Zero)
            {
                chPtr += RuntimeHelpers.OffsetToStringData;
            }
            char *str2 = chPtr;

            if (!Number.ParseNumber(ref str2, options, ref number, (StringBuilder)null, info, parseDecimal) || str2 - chPtr < (long)str.Length && !Number.TrailingZeros(str, (int)(str2 - chPtr)))
            {
                throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
            }
            str1 = (string)null;
        }
All Usage Examples Of System.Number::TrailingZeros