EFIngresProvider/Helpers/IngresDateData.cs
/// <summary>
/// Scan the date/time/interval string and tokenize it.
/// </summary>
/// <param name="dateTimeString"></param>
/// <returns>A StringCollection of token strings.</returns>
Scan the date/time/interval string and tokenize it.
Scan the date / time / interval string and tokenize it .
static public IEnumerable<string> ScanDateTime(string dateTimeString)
        {
            var sbToken = new StringBuilder(15);
            var i = 0;
            while (i < dateTimeString.Length)
            {
                if (Char.IsWhiteSpace(dateTimeString[i]))
                {
                    i++;
                    continue;  
                }
                if (Char.IsNumber(dateTimeString[i]))
                {
                    char decimal_point = ':';
                    while ((i < dateTimeString.Length) &&
                           (Char.IsNumber(dateTimeString[i]) || dateTimeString[i] == ':' || dateTimeString[i] == decimal_point))
                    {
                        if (dateTimeString[i] == ':')
                        {
                            decimal_point = '.'; 
                        }
                        sbToken.Append(dateTimeString[i++]);
                    }
                }
                else if (Char.IsLetter(dateTimeString[i]))
                {
                    while ((i < dateTimeString.Length) && (Char.IsLetter(dateTimeString[i])))
                    {
                        sbToken.Append(dateTimeString[i++]);
                    }
                }
                else  
                {
                    sbToken.Append(dateTimeString[i++]);
                }
                if (sbToken.Length > 0)
                {
                    yield return sbToken.ToString();
                }
                sbToken.Length = 0;
                continue;   
            }  
        }
static public IEnumerable < string > ScanDateTime ( string dateTimeString ) { var sbToken = new StringBuilder ( 15 ) ; var i = 0 ; while ( i < dateTimeString . Length ) { if ( Char . IsWhiteSpace ( dateTimeString [ i ] ) ) { i ++ ; continue ; } if ( Char . IsNumber ( dateTimeString [ i ] ) ) { char decimal_point = ' ' ; while ( ( i < dateTimeString . Length ) && ( Char . IsNumber ( dateTimeString [ i ] ) || dateTimeString [ i ] == ' ' || dateTimeString [ i ] == decimal_point ) ) { if ( dateTimeString [ i ] == ' ' ) { decimal_point = ' ' ; } sbToken . Append ( dateTimeString [ i ++ ] ) ; } } else if ( Char . IsLetter ( dateTimeString [ i ] ) ) { while ( ( i < dateTimeString . Length ) && ( Char . IsLetter ( dateTimeString [ i ] ) ) ) { sbToken . Append ( dateTimeString [ i ++ ] ) ; } } else { sbToken . Append ( dateTimeString [ i ++ ] ) ; } if ( sbToken . Length > 0 ) { yield return sbToken . ToString ( ) ; } sbToken . Length = 0 ; continue ; } }
Scan the date/time/interval string and tokenize it.
Scan the date / time / interval string and tokenize it .
// loop thru chars and build tokens // skip over whitespace // if nn:nn:nn form // enable decimal_pt // not number, not identifier, must be hyphen // loop to next char for next token // end while (i < dateTimeString.Length) loop thru chars
A StringCollection of token strings.
A StringCollection of token strings .
dateTimeString
string
None