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

Unified Diff: sdk/lib/core/pattern.dart

Issue 15709018: Proof-of-concept matchPrefix on Pattern. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed other comments. Created 7 years, 6 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: sdk/lib/core/pattern.dart
diff --git a/sdk/lib/core/pattern.dart b/sdk/lib/core/pattern.dart
index ac7815dd6ec1fc6245318a21d8ea9f973c4a582f..d85c8ac970f9102f3d8fcf086e687fa4a353adc5 100644
--- a/sdk/lib/core/pattern.dart
+++ b/sdk/lib/core/pattern.dart
@@ -5,5 +5,28 @@
part of dart.core;
abstract class Pattern {
+ /**
+ * Match this pattern against the string repeatedly.
+ *
+ * The iterable will contain all the non-overlapping matches of the
+ * pattern on the string, ordered by start index.
+ *
+ * The matches are found by repeatedly finding the first match
+ * of the pattern on the string, starting from the end of the previous
+ * match, and initially starting from index zero.
+ *
+ * If the pattern matches the empty string at some point, the next
+ * match is found by starting at the previous match's end plus one.
+ */
Iterable<Match> allMatches(String str);
+
+ /**
+ * Match this pattern against the start of string.
+ *
+ * If [start] is provided, it must be an integer in the range `0` ..
+ * `string.length`. In that case, this patten is tested against the
+ * string at the [start] position. That is, a match is returned if the
+ * pattern can match a part of the string starting from position [start].
+ */
+ Match matchAsPrefix(String string, [int start = 0]);
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/regexp_helper.dart ('k') | tests/corelib/string_pattern_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698