MutableStringMatch class
class MutableStringMatch extends Match { final MutableStringMatchesIterable _iterator; final Match _match; final int start; final int end; final String input; MutableStringMatch(this._iterator, this._match, this.start, this.end, this.input); @override String group(int group) => _match.group(group); @override String operator [](int group) => _match.group(group); @override List<String> groups(List<int> groupIndices) => _match.groups(groupIndices); @override int get groupCount => _match.groupCount; @override Pattern get pattern => _match.pattern; /// Set the iterator's last index set lastIndex(int index) => _iterator.lastIndex = index; /// Get the iterator's last index int get lastIndex => _iterator.lastIndex; void replacePart(int startIndex, int endIndex, [String replacement = '']){ _iterator.mutableString.replacePart(startIndex, endIndex, replacement); if (startIndex < this._iterator.lastIndex) { //TODO <= ? _iterator.lastIndex = _iterator.lastIndex - (endIndex - startIndex) + replacement.length; } } }
Extends
Match > MutableStringMatch
Constructors
new MutableStringMatch(MutableStringMatchesIterable _iterator, Match _match, int start, int end, String input) #
Creates a new Object
instance.
Object
instances have no meaningful state, and are only useful
through their identity. An Object
instance is equal to itself
only.
MutableStringMatch(this._iterator, this._match, this.start, this.end, this.input);
Properties
final int end #
Returns the index in the string after the last character of the match.
final int end
final int groupCount #
Returns the number of captured groups in the match.
Some patterns may capture parts of the input that was used to compute the full match. This is the number of captured groups, which is also the maximal allowed argument to the group method.
@override int get groupCount => _match.groupCount;
final String input #
The string on which this match was computed.
final String input
int get lastIndex #
Get the iterator's last index
int get lastIndex => _iterator.lastIndex;
dynamic set lastIndex(int index) #
Set the iterator's last index
set lastIndex(int index) => _iterator.lastIndex = index;
final Pattern pattern #
The pattern used to search in input.
@override Pattern get pattern => _match.pattern;
final int start #
Returns the index in the string where the match starts.
final int start
Operators
String operator [](int group) #
Returns the string matched by the given group.
If group is 0, returns the match of the pattern.
Short alias for Match.group
.
@override String operator [](int group) => _match.group(group);
Methods
String group(int group) #
Returns the string matched by the given group.
If group is 0, returns the match of the pattern.
The result may be null
if the pattern didn't assign a value to it
as part of this match.
@override String group(int group) => _match.group(group);
List<String> groups(List<int> groupIndices) #
Returns a list of the groups with the given indices.
The list contains the strings returned by group for each index in groupIndices.
@override List<String> groups(List<int> groupIndices) => _match.groups(groupIndices);
void replacePart(int startIndex, int endIndex, [String replacement = '']) #
void replacePart(int startIndex, int endIndex, [String replacement = '']){ _iterator.mutableString.replacePart(startIndex, endIndex, replacement); if (startIndex < this._iterator.lastIndex) { //TODO <= ? _iterator.lastIndex = _iterator.lastIndex - (endIndex - startIndex) + replacement.length; } }