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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 * | 470 * |
471 * pigLatin(String words) => words.replaceAllMapped( | 471 * pigLatin(String words) => words.replaceAllMapped( |
472 * new RegExp(r'\b(\w*?)([aeiou]\w*)', caseSensitive: false), | 472 * new RegExp(r'\b(\w*?)([aeiou]\w*)', caseSensitive: false), |
473 * (Match m) => "${m[2]}${m[1]}${m[1].isEmpty ? 'way' : 'ay'}"); | 473 * (Match m) => "${m[2]}${m[1]}${m[1].isEmpty ? 'way' : 'ay'}"); |
474 * | 474 * |
475 * pigLatin('I have a secret now!'); // 'Iway avehay away ecretsay ownay!' | 475 * pigLatin('I have a secret now!'); // 'Iway avehay away ecretsay ownay!' |
476 */ | 476 */ |
477 String replaceAllMapped(Pattern from, String replace(Match match)); | 477 String replaceAllMapped(Pattern from, String replace(Match match)); |
478 | 478 |
479 /** | 479 /** |
480 * Replaces the substring from [start] to [end] with [replacement]. | |
481 * | |
482 * Returns a new string equivalent to: | |
483 * | |
484 * this.substring(0, start) + replacement + this.substring(end) | |
485 * | |
486 * The [start] and [end] indices must specify a valid range of this string. | |
487 * That is `0 <= start <= end <= this.length`. | |
488 * If [end] is omitted, it defaults to [length]. | |
489 */ | |
490 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
| |
491 | |
492 /** | |
480 * Splits the string at matches of [pattern] and returns a list of substrings. | 493 * Splits the string at matches of [pattern] and returns a list of substrings. |
481 * | 494 * |
482 * Finds all the matches of `pattern` in this string, | 495 * Finds all the matches of `pattern` in this string, |
483 * and returns the list of the substrings between the matches. | 496 * and returns the list of the substrings between the matches. |
484 * | 497 * |
485 * var string = "Hello world!"; | 498 * var string = "Hello world!"; |
486 * string.split(" "); // ['Hello', 'world!']; | 499 * string.split(" "); // ['Hello', 'world!']; |
487 * | 500 * |
488 * Empty matches at the beginning and end of the strings are ignored, | 501 * Empty matches at the beginning and end of the strings are ignored, |
489 * and so are empty matches right after another match. | 502 * and so are empty matches right after another match. |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 _position = position - 1; | 784 _position = position - 1; |
772 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 785 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
773 return true; | 786 return true; |
774 } | 787 } |
775 } | 788 } |
776 _position = position; | 789 _position = position; |
777 _currentCodePoint = codeUnit; | 790 _currentCodePoint = codeUnit; |
778 return true; | 791 return true; |
779 } | 792 } |
780 } | 793 } |
OLD | NEW |