| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 * index: | 406 * index: |
| 407 * | 407 * |
| 408 * string.contains('X', 1); // false | 408 * string.contains('X', 1); // false |
| 409 * string.contains(new RegExp(r'[A-Z]'), 1); // false | 409 * string.contains(new RegExp(r'[A-Z]'), 1); // false |
| 410 * | 410 * |
| 411 * [startIndex] must not be negative or greater than [length]. | 411 * [startIndex] must not be negative or greater than [length]. |
| 412 */ | 412 */ |
| 413 bool contains(Pattern other, [int startIndex = 0]); | 413 bool contains(Pattern other, [int startIndex = 0]); |
| 414 | 414 |
| 415 /** | 415 /** |
| 416 * Returns a new string in which the first occurence of [from] in this string | 416 * Returns a new string in which the first occurrence of [from] in this string |
| 417 * is replaced with [to], starting from [startIndex]: | 417 * is replaced with [to], starting from [startIndex]: |
| 418 * | 418 * |
| 419 * '0.0001'.replaceFirst(new RegExp(r'0'), ''); // '.0001' | 419 * '0.0001'.replaceFirst(new RegExp(r'0'), ''); // '.0001' |
| 420 * '0.0001'.replaceFirst(new RegExp(r'0'), '7', 1); // '0.7001' | 420 * '0.0001'.replaceFirst(new RegExp(r'0'), '7', 1); // '0.7001' |
| 421 */ | 421 */ |
| 422 String replaceFirst(Pattern from, String to, [int startIndex = 0]); | 422 String replaceFirst(Pattern from, String to, [int startIndex = 0]); |
| 423 | 423 |
| 424 /** | 424 /** |
| 425 * Replace the first occurence of [from] in this string. | 425 * Replace the first occurrence of [from] in this string. |
| 426 * | 426 * |
| 427 * Returns a new string, which is this string | 427 * Returns a new string, which is this string |
| 428 * except that the first match of [pattern], starting from [startIndex], | 428 * except that the first match of [pattern], starting from [startIndex], |
| 429 * is replaced by the result of calling [replace] with the match object. | 429 * is replaced by the result of calling [replace] with the match object. |
| 430 * | 430 * |
| 431 * The optional [startIndex] is by default set to 0. If provided, it must be | 431 * The optional [startIndex] is by default set to 0. If provided, it must be |
| 432 * an integer in the range `[0 .. len]`, where `len` is this string's length. | 432 * an integer in the range `[0 .. len]`, where `len` is this string's length. |
| 433 * | 433 * |
| 434 * If the value returned by calling `replace` is not a [String], it | 434 * If the value returned by calling `replace` is not a [String], it |
| 435 * is converted to a `String` using its `toString` method, which must | 435 * is converted to a `String` using its `toString` method, which must |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 _position = position - 1; | 786 _position = position - 1; |
| 787 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 787 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
| 788 return true; | 788 return true; |
| 789 } | 789 } |
| 790 } | 790 } |
| 791 _position = position; | 791 _position = position; |
| 792 _currentCodePoint = codeUnit; | 792 _currentCodePoint = codeUnit; |
| 793 return true; | 793 return true; |
| 794 } | 794 } |
| 795 } | 795 } |
| OLD | NEW |