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

Unified Diff: tool/input_sdk/lib/core/string.dart

Issue 1950133003: Update String methods. (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Created 4 years, 7 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 | « lib/runtime/dart_sdk.js ('k') | tool/input_sdk/private/js_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/lib/core/string.dart
diff --git a/tool/input_sdk/lib/core/string.dart b/tool/input_sdk/lib/core/string.dart
index 8d6d3225f5d5dc1cb3a0c3693bb18299dd2208b6..a36fbc5e496bd0b27fac27fe2e4ca6ab0f5835ae 100644
--- a/tool/input_sdk/lib/core/string.dart
+++ b/tool/input_sdk/lib/core/string.dart
@@ -86,9 +86,8 @@ part of dart.core;
* Also see:
* * [Dart Cookbook](https://www.dartlang.org/docs/cookbook/#strings)
- * for String examples and recipes.
- * * [Dart Up and Running]
- * (https://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#ch03-strings-and-regular-expressions)
+ * for String examples and recipes.
+ * * [Dart Up and Running](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#strings-and-regular-expressions)
*/
abstract class String implements Comparable<String>, Pattern {
/**
@@ -414,7 +413,7 @@ abstract class String implements Comparable<String>, Pattern {
bool contains(Pattern other, [int startIndex = 0]);
/**
- * Returns a new string in which the first occurence of [from] in this string
+ * Returns a new string in which the first occurence of [from] in this string
* is replaced with [to], starting from [startIndex]:
*
* '0.0001'.replaceFirst(new RegExp(r'0'), ''); // '.0001'
@@ -423,6 +422,20 @@ abstract class String implements Comparable<String>, Pattern {
String replaceFirst(Pattern from, String to, [int startIndex = 0]);
/**
+ * Replace the first occurence of [from] in this string.
+ *
+ * Returns a new string, which is this string
+ * except that the first match of [pattern], starting from [startIndex],
+ * is replaced by the result of calling [replace] with the match object.
+ *
+ * If the value returned by calling `replace` is not a [String], it
+ * is converted to a `String` using its `toString` method, which must
+ * then return a string.
+ */
+ String replaceFirstMapped(Pattern from, String replace(Match match),
+ [int startIndex = 0]);
+
+ /**
* Replaces all substrings that match [from] with [replace].
*
* Returns a new string in which the non-overlapping substrings matching
@@ -463,6 +476,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 `null`, it defaults to [length].
+ */
+ String replaceRange(int start, int end, String replacement);
+
+ /**
* Splits the string at matches of [pattern] and returns a list of substrings.
*
* Finds all the matches of `pattern` in this string,
@@ -626,7 +652,7 @@ class RuneIterator implements BidirectionalIterator<int> {
* If the iterator has hit either end, the [_currentCodePoint] is null
* and [: _position == _nextPosition :].
*/
- num _currentCodePoint;
+ int _currentCodePoint;
/** Create an iterator positioned at the beginning of the string. */
RuneIterator(String string)
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | tool/input_sdk/private/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698