CNCGUI.TextParser.Extract C# (CSharp) Method

Extract() public method

Extracts a substring from the specified position to the end of the text
public Extract ( int start ) : string
start int
return string
        public string Extract(int start)
        {
            return Extract(start, _text.Length);
        }

Same methods

TextParser::Extract ( int start, int end ) : string

Usage Example

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::Extract