Chromium Code Reviews| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 * | 402 * |
| 403 * string.contains('X', 1); // false | 403 * string.contains('X', 1); // false |
| 404 * string.contains(new RegExp(r'[A-Z]'), 1); // false | 404 * string.contains(new RegExp(r'[A-Z]'), 1); // false |
| 405 * | 405 * |
| 406 * [startIndex] must not be negative or greater than [length]. | 406 * [startIndex] must not be negative or greater than [length]. |
| 407 */ | 407 */ |
| 408 bool contains(Pattern other, [int startIndex = 0]); | 408 bool contains(Pattern other, [int startIndex = 0]); |
| 409 | 409 |
| 410 /** | 410 /** |
| 411 * Returns a new string in which the first occurence of [from] in this string | 411 * Returns a new string in which the first occurence of [from] in this string |
| 412 * is replaced with [to]: | 412 * is replaced with [to], optionally starting at [startIndex]: |
|
Lasse Reichstein Nielsen
2014/08/19 07:26:45
Not optionally. It always starts at startIndex, so
srawlins
2014/08/19 21:42:32
Done.
| |
| 413 * | 413 * |
| 414 * '0.0001'.replaceFirst(new RegExp(r'0'), ''); // '.0001' | 414 * '0.0001'.replaceFirst(new RegExp(r'0'), ''); // '.0001' |
| 415 * '0.0001'.replaceFirst(new RegExp(r'0'), '7', 1); // '0.7001' | |
| 415 */ | 416 */ |
| 416 String replaceFirst(Pattern from, String to); | 417 String replaceFirst(Pattern from, String to, [int startIndex = 0]); |
| 417 | 418 |
| 418 /** | 419 /** |
| 419 * Replaces all substrings that match [from] with [replace]. | 420 * Replaces all substrings that match [from] with [replace]. |
| 420 * | 421 * |
| 421 * Returns a new string in which the non-overlapping substrings matching | 422 * Returns a new string in which the non-overlapping substrings matching |
| 422 * [from] (the ones iterated by `from.allMatches(thisString)`) are replaced | 423 * [from] (the ones iterated by `from.allMatches(thisString)`) are replaced |
| 423 * by the literal string [replace]. | 424 * by the literal string [replace]. |
| 424 * | 425 * |
| 425 * 'resume'.replaceAll(new RegExp(r'e'), 'é'); // 'résumé' | 426 * 'resume'.replaceAll(new RegExp(r'e'), 'é'); // 'résumé' |
| 426 * | 427 * |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 735 _position = position - 1; | 736 _position = position - 1; |
| 736 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 737 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
| 737 return true; | 738 return true; |
| 738 } | 739 } |
| 739 } | 740 } |
| 740 _position = position; | 741 _position = position; |
| 741 _currentCodePoint = codeUnit; | 742 _currentCodePoint = codeUnit; |
| 742 return true; | 743 return true; |
| 743 } | 744 } |
| 744 } | 745 } |
| OLD | NEW |