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

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

Issue 462463003: Add optional startIndex to String.replaceFirst (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Little fixes 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
« no previous file with comments | « sdk/lib/_internal/lib/string_helper.dart ('k') | tests/corelib/string_replace_test.dart » ('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 ebc6c20700299974fe4fd4336bce9b203114e2ac..384b183c0b50af170b709dedb18605cc4e5eede3 100644
--- a/sdk/lib/core/string.dart
+++ b/sdk/lib/core/string.dart
@@ -409,11 +409,12 @@ abstract class String implements Comparable<String>, Pattern {
/**
* Returns a new string in which the first occurence of [from] in this string
- * is replaced with [to]:
+ * is replaced with [to], starting from [startIndex]:
*
* '0.0001'.replaceFirst(new RegExp(r'0'), ''); // '.0001'
+ * '0.0001'.replaceFirst(new RegExp(r'0'), '7', 1); // '0.7001'
*/
- String replaceFirst(Pattern from, String to);
+ String replaceFirst(Pattern from, String to, [int startIndex = 0]);
/**
* Replaces all substrings that match [from] with [replace].
« no previous file with comments | « sdk/lib/_internal/lib/string_helper.dart ('k') | tests/corelib/string_replace_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698