Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: runtime/lib/string_patch.dart

Issue 460613002: Add optional start index to Pattern.allMatches. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add extra test. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/lib/string_patch.dart
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index 11f549338be8cc80828f2aa37059c0845315c51a..f750fc31f153281a011307d53d6e7ee6481ed193 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -540,17 +540,17 @@ class _StringBase {
return _concatRangeNative(stringList, 0, stringList.length);
}
- Iterable<Match> allMatches(String str) {
+ Iterable<Match> allMatches(String string, [int start = 0]) {
List<Match> result = new List<Match>();
- int length = str.length;
+ int length = string.length;
int patternLength = this.length;
- int startIndex = 0;
+ int startIndex = start;
while (true) {
- int position = str.indexOf(this, startIndex);
+ int position = string.indexOf(this, startIndex);
if (position == -1) {
break;
}
- result.add(new _StringMatch(position, str, this));
+ result.add(new _StringMatch(position, string, this));
int endIndex = position + patternLength;
if (endIndex == length) {
break;

Powered by Google App Engine
This is Rietveld 408576698