skipString method
- String s
Skip over s
and return true
if s
matches the text after the cursor, and return false
otherwise.
You might also be interested in:
- skipWhitespace, for skipping arbitrary spans of whitespace.
- skipPattern, for testing arbitrary patterns.
Implementation
bool skipString(String s) {
if (index + s.length < end && buffer.substring(index, index + s.length) == s) {
history.add(index);
index += s.length;
return true;
}
return false;
}