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

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

Issue 16957002: Use Pattern.matchAsPrefix to let String.indexOf/lastIndexOf/startsWith accept Pattern. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/regexp_helper.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/string.dart
diff --git a/sdk/lib/core/string.dart b/sdk/lib/core/string.dart
index 0b4fbd4b6ac5817e15b2d47e12c8cb26b25eb3db..0d2503a8e2c89dacaabd1d681dc69b4121432871 100644
--- a/sdk/lib/core/string.dart
+++ b/sdk/lib/core/string.dart
@@ -105,23 +105,29 @@ abstract class String implements Comparable<String>, Pattern {
bool endsWith(String other);
/**
- * Returns whether this string starts with [other].
+ * Returns whether this string starts with a match of [pattern].
*/
- bool startsWith(String other);
+ bool startsWith(Pattern pattern);
/**
- * Returns the first location of [other] in this string starting at
- * [start] (inclusive).
- * Returns -1 if [other] could not be found.
+ * Returns the first position of a match of [pattern] in this string,
+ * starting at [start] (inclusive).
+ *
+ * Returns -1 if a match could not be found.
+ *
+ * It is an error if start is negative or greater than [length].
*/
- int indexOf(String other, [int start]);
+ int indexOf(Pattern pattern, [int start]);
/**
- * Returns the last location of [other] in this string, searching
+ * Returns the last position of a match [pattern] in this string, searching
* backward starting at [start] (inclusive).
+ *
* Returns -1 if [other] could not be found.
sra1 2013/06/13 17:49:21 [pattern]
Lasse Reichstein Nielsen 2013/06/13 19:43:55 Ack!
+ *
+ * It is an error if start is negative or greater than [length].
*/
- int lastIndexOf(String other, [int start]);
+ int lastIndexOf(Pattern pattern, [int start]);
/**
* Returns whether this string is empty.
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/regexp_helper.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698