Parser.ParserBase.SkipWhiteSpace C# (CSharp) Method

SkipWhiteSpace() public static method

Skips the white space symbols located at the specified position.
public static SkipWhiteSpace ( string text, int &position ) : void
text string
position int
return void
        public static void SkipWhiteSpace(string text, ref int position)
        {
            #region Check the parameters

            CheckTextAndPositionArguments(text, position);

            #endregion

            while (position < text.Length)
            {
                if (!char.IsWhiteSpace(text, position))
                    break;
                position++;
            }
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Checks whether there is the tag at the specified position
        /// in the specified sql.
        /// </summary>
        /// <name>The value of the Name property.</name>
        /// <returns>
        /// The position after the tag or -1 there is no tag at the position.
        /// </returns>
        internal static int MatchStart(string firstWord, string secondWord, string sql, int position)
        {
            #region Check the arguments

            ParserBase.CheckTextAndPositionArguments(sql, position);

            #endregion

            if (string.Compare(sql, position, firstWord, 0, firstWord.Length, true) != 0)
            {
                return(-1);
            }

            position += firstWord.Length;

            ParserBase.SkipWhiteSpace(sql, ref position);
            if (position == sql.Length)
            {
                return(-1);
            }

            if (string.Compare(sql, position, secondWord, 0, secondWord.Length, true) != 0)
            {
                return(-1);
            }

            return(position + secondWord.Length);
        }