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

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

Issue 949753005: Add String.replaceRange and use it in replaceFirst{,Mapped}. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move "copy-one-byte-string-to-result" to helper method. Created 5 years, 10 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/string.dart
diff --git a/sdk/lib/core/string.dart b/sdk/lib/core/string.dart
index 625446fb8df99ec859c2052dbd6f32b0138ebb1b..1930e4f3ce91e9657d283cdfedbe649b70506f52 100644
--- a/sdk/lib/core/string.dart
+++ b/sdk/lib/core/string.dart
@@ -477,6 +477,19 @@ abstract class String implements Comparable<String>, Pattern {
String replaceAllMapped(Pattern from, String replace(Match match));
/**
+ * Replaces the substring from [start] to [end] with [replacement].
+ *
+ * Returns a new string equivalent to:
+ *
+ * this.substring(0, start) + replacement + this.substring(end)
+ *
+ * The [start] and [end] indices must specify a valid range of this string.
+ * That is `0 <= start <= end <= this.length`.
+ * If [end] is omitted, it defaults to [length].
+ */
+ String replaceRange(String replacement, int start, [int end]);
floitsch 2015/02/23 14:36:35 replaceRange in List takes the start-end first and
kevmoo 2015/02/23 19:14:23 Could we look into named arguments? Then someone
Lasse Reichstein Nielsen 2015/02/25 12:09:09 I agree that consistency wants to put the start/en
+
+ /**
* Splits the string at matches of [pattern] and returns a list of substrings.
*
* Finds all the matches of `pattern` in this string,

Powered by Google App Engine
This is Rietveld 408576698