OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.core; | 5 part of dart.core; |
6 | 6 |
7 /** | 7 /** |
8 * A sequence of characters. | 8 * A sequence of characters. |
9 * | 9 * |
10 * A string can be either single or multiline. Single line strings are | 10 * A string can be either single or multiline. Single line strings are |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 /** | 430 /** |
431 * Replace the first occurrence of [from] in this string. | 431 * Replace the first occurrence of [from] in this string. |
432 * | 432 * |
433 * Returns a new string, which is this string | 433 * Returns a new string, which is this string |
434 * except that the first match of [from], starting from [startIndex], | 434 * except that the first match of [from], starting from [startIndex], |
435 * is replaced by the result of calling [replace] with the match object. | 435 * is replaced by the result of calling [replace] with the match object. |
436 * | 436 * |
437 * The optional [startIndex] is by default set to 0. If provided, it must be | 437 * The optional [startIndex] is by default set to 0. If provided, it must be |
438 * an integer in the range `[0 .. len]`, where `len` is this string's length. | 438 * an integer in the range `[0 .. len]`, where `len` is this string's length. |
439 * | |
440 * If the value returned by calling `replace` is not a [String], it | |
441 * is converted to a `String` using its `toString` method, which must | |
442 * then return a string. | |
443 */ | 439 */ |
444 String replaceFirstMapped(Pattern from, String replace(Match match), | 440 String replaceFirstMapped(Pattern from, String replace(Match match), |
445 [int startIndex = 0]); | 441 [int startIndex = 0]); |
446 | 442 |
447 /** | 443 /** |
448 * Replaces all substrings that match [from] with [replace]. | 444 * Replaces all substrings that match [from] with [replace]. |
449 * | 445 * |
450 * Returns a new string in which the non-overlapping substrings matching | 446 * Returns a new string in which the non-overlapping substrings matching |
451 * [from] (the ones iterated by `from.allMatches(thisString)`) are replaced | 447 * [from] (the ones iterated by `from.allMatches(thisString)`) are replaced |
452 * by the literal string [replace]. | 448 * by the literal string [replace]. |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 _position = position - 1; | 791 _position = position - 1; |
796 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 792 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
797 return true; | 793 return true; |
798 } | 794 } |
799 } | 795 } |
800 _position = position; | 796 _position = position; |
801 _currentCodePoint = codeUnit; | 797 _currentCodePoint = codeUnit; |
802 return true; | 798 return true; |
803 } | 799 } |
804 } | 800 } |
OLD | NEW |