// Creates a TokenInfo for a separator token.
 public static TokenInfo CreateSeparator(string formatString, int startIdx, int tokLen) {
     Debug.Assert(startIdx >= 0 && tokLen > 0);
     TokenInfo token = new TokenInfo(); {
         token.startIdx     = startIdx;
         token.formatString = formatString;
         token.length       = tokLen;
     }
     return token;
 }
        // Maps a token of alphanumeric characters to a numbering format ID and a
        // minimum length bound.  Tokens specify the character(s) that begins a Unicode
        // numbering sequence.  For example, "i" specifies lower case roman numeral
        // numbering.  Leading "zeros" specify a minimum length to be maintained by
        // padding, if necessary.
        public static TokenInfo CreateFormat(string formatString, int startIdx, int tokLen) {
            Debug.Assert(startIdx >= 0 && tokLen > 0);
            TokenInfo token = new TokenInfo();
            token.formatString = null;
            token.length = 1;

            bool useDefault = false;
            char ch = formatString[startIdx];

            switch (ch) {
            case '1':
            case 'A':
            case 'I':
            case 'a':
            case 'i':
                break;
            default:
                // NOTE: We do not support Tamil and Ethiopic numbering systems having no zeros
                if (CharUtil.IsDecimalDigitOne(ch)) {
                    break;
                }
                if (CharUtil.IsDecimalDigitOne((char)(ch + 1))) {
                    // Leading zeros request padding.  Track how much.
                    int idx = startIdx;
                    do {
                        token.length++;
                    } while (--tokLen > 0 && ch == formatString[++idx]);

                    // Recognize the token only if the next character is "one"
                    if (formatString[idx] == ++ch) {
                        break;
                    }
                }
                useDefault = true;
                break;
            }

            if (tokLen != 1) {
                // If remaining token length is not 1, do not recognize the token
                useDefault = true;
            }

            if (useDefault) {
                // Default to Arabic numbering with no zero padding
                token.startChar = NumberFormatter.DefaultStartChar;
                token.length = 1;
            } else {
                token.startChar = ch;
            }
            return token;
        }