System.Globalization.FormatProvider.Number.ParseFormatSpecifier C# (CSharp) Method

ParseFormatSpecifier() static private method

static private ParseFormatSpecifier ( string format, int &digits ) : char
format string
digits int
return char
            internal static unsafe char ParseFormatSpecifier(string format, out int digits)
            {
                if (format != null)
                {
                    fixed (char* pFormat = format)
                    {
                        int i = 0;
                        char ch = pFormat[i];
                        if (ch != 0)
                        {
                            if (((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z')))
                            {
                                i++;
                                int n = -1;
                                if ((pFormat[i] >= '0') && (pFormat[i] <= '9'))
                                {
                                    n = pFormat[i++] - '0';
                                    while ((pFormat[i] >= '0') && (pFormat[i] <= '9'))
                                    {
                                        n = (n * 10) + pFormat[i++] - '0';
                                        if (n >= 10)
                                            break;
                                    }
                                }
                                if (pFormat[i] == 0)
                                {
                                    digits = n;
                                    return ch;
                                }
                            }

                            digits = -1;
                            return '\0';
                        }
                    }
                }

                digits = -1;
                return 'G';
            }