A class that scans through a string using Patterns.

Implemented by

Constructors

StringScanner(String string, {sourceUrl, int position})

Creates a new StringScanner that starts scanning from position.

Properties

hashCode → int

Get a hash code for this object.

read-only, inherited
isDone → bool

Whether the scanner has completely consumed string.

read-only
lastMatch → Match

The data about the previous match made by the scanner.

read-only
position → int

The current position of the scanner in the string, in characters.

read / write
rest → String

The portion of the string that hasn't yet been scanned.

read-only
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited
sourceUrl → Uri

The URL of the source of the string being scanned.

read-only
string → String

The string being scanned through.

read-only

Operators

operator ==(other) → bool

The equality operator.

inherited

Methods

error(String message, {Match match, int position, int length}) → void

Throws a FormatException with message as well as a detailed description of the location of the error in the string.

expect(Pattern pattern, {String name}) → void

If pattern matches at the current position of the string, scans forward until the end of the match.

expectDone() → void

If the string has not been fully consumed, this throws a FormatException.

matches(Pattern pattern) → bool

Returns whether or not pattern matches at the current position of the string.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
peekChar([int offset]) → int

Returns the character code of the character offset away from position.

readChar() → int

Consumes a single character and returns its character code.

scan(Pattern pattern) → bool

If pattern matches at the current position of the string, scans forward until the end of the match.

substring(int start, [int end]) → String

Returns the substring of string between start and end.

toString() → String

Returns a string representation of this object.

inherited