System.Globalization.DateTimeFormatInfoScanner.ScanRepeatChar C# (CSharp) Method

ScanRepeatChar() static private method

static private ScanRepeatChar ( String pattern, char ch, int index, int &count ) : int
pattern String
ch char
index int
count int
return int
        internal static int ScanRepeatChar(String pattern, char ch, int index, out int count)
        {
            count = 1;
            while (++index < pattern.Length && pattern[index] == ch) {
                count++;
            }
            // Return the updated position.
            return (index);        
        }

Usage Example

Example #1
0
 // Token: 0x06002E14 RID: 11796 RVA: 0x000B0A10 File Offset: 0x000AEC10
 internal void ScanDateWord(string pattern)
 {
     this.m_ymdFlags = DateTimeFormatInfoScanner.FoundDatePattern.None;
     for (int i = 0; i < pattern.Length; i++)
     {
         char c = pattern[i];
         if (c <= 'M')
         {
             if (c == '\'')
             {
                 i = this.AddDateWords(pattern, i + 1, null);
                 continue;
             }
             if (c == '.')
             {
                 if (this.m_ymdFlags == DateTimeFormatInfoScanner.FoundDatePattern.FoundYMDPatternFlag)
                 {
                     this.AddIgnorableSymbols(".");
                     this.m_ymdFlags = DateTimeFormatInfoScanner.FoundDatePattern.None;
                 }
                 i++;
                 continue;
             }
             if (c == 'M')
             {
                 int num;
                 i = DateTimeFormatInfoScanner.ScanRepeatChar(pattern, 'M', i, out num);
                 if (num >= 4 && i < pattern.Length && pattern[i] == '\'')
                 {
                     i = this.AddDateWords(pattern, i + 1, "MMMM");
                 }
                 this.m_ymdFlags |= DateTimeFormatInfoScanner.FoundDatePattern.FoundMonthPatternFlag;
                 continue;
             }
         }
         else
         {
             if (c == '\\')
             {
                 i += 2;
                 continue;
             }
             if (c != 'd')
             {
                 if (c == 'y')
                 {
                     int num;
                     i = DateTimeFormatInfoScanner.ScanRepeatChar(pattern, 'y', i, out num);
                     this.m_ymdFlags |= DateTimeFormatInfoScanner.FoundDatePattern.FoundYearPatternFlag;
                     continue;
                 }
             }
             else
             {
                 int num;
                 i = DateTimeFormatInfoScanner.ScanRepeatChar(pattern, 'd', i, out num);
                 if (num <= 2)
                 {
                     this.m_ymdFlags |= DateTimeFormatInfoScanner.FoundDatePattern.FoundDayPatternFlag;
                     continue;
                 }
                 continue;
             }
         }
         if (this.m_ymdFlags == DateTimeFormatInfoScanner.FoundDatePattern.FoundYMDPatternFlag && !char.IsWhiteSpace(c))
         {
             this.m_ymdFlags = DateTimeFormatInfoScanner.FoundDatePattern.None;
         }
     }
 }
All Usage Examples Of System.Globalization.DateTimeFormatInfoScanner::ScanRepeatChar