CNCGUI.TextParser.MovePastWhitespace C# (CSharp) Метод

MovePastWhitespace() публичный Метод

Moves the current position to the next character that is not whitespace
public MovePastWhitespace ( ) : void
Результат void
        public void MovePastWhitespace()
        {
            while (Char.IsWhiteSpace(Peek()))
                MoveAhead();
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Parse a string field
        /// </summary>
        private bool ParseString(TextParser input, FormatSpecifier spec)
        {
            // Skip any whitespace
            input.MovePastWhitespace();

            // Parse string characters
            int start = input.Position;

            while (!input.EndOfText && !Char.IsWhiteSpace(input.Peek()))
            {
                input.MoveAhead();
            }

            // Don't exceed field width
            if (spec.Width > 0)
            {
                int count = input.Position - start;
                if (spec.Width < count)
                {
                    input.MoveAhead(spec.Width - count);
                }
            }

            // Extract token
            if (input.Position > start)
            {
                if (!spec.NoResult)
                {
                    Results.Add(input.Extract(start, input.Position));
                }
                return(true);
            }
            return(false);
        }
All Usage Examples Of CNCGUI.TextParser::MovePastWhitespace