| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 * If the string is already in all upper case, this method returns [:this:]. | 589 * If the string is already in all upper case, this method returns [:this:]. |
| 590 * | 590 * |
| 591 * 'alphabet'.toUpperCase(); // 'ALPHABET' | 591 * 'alphabet'.toUpperCase(); // 'ALPHABET' |
| 592 * 'ABC'.toUpperCase(); // 'ABC' | 592 * 'ABC'.toUpperCase(); // 'ABC' |
| 593 * | 593 * |
| 594 * This function uses the language independent Unicode mapping and thus only | 594 * This function uses the language independent Unicode mapping and thus only |
| 595 * works in some languages. | 595 * works in some languages. |
| 596 */ | 596 */ |
| 597 // TODO(floitsch): document better. (See EcmaScript for description). | 597 // TODO(floitsch): document better. (See EcmaScript for description). |
| 598 String toUpperCase(); | 598 String toUpperCase(); |
| 599 |
| 600 static String _stringFromIterable(Iterable<int> charCodes, |
| 601 int start, int end) { |
| 602 if (start < 0) throw new RangeError.range(start, 0, charCodes.length); |
| 603 if (end != null && end < start) { |
| 604 throw new RangeError.range(end, start, charCodes.length); |
| 605 } |
| 606 var it = charCodes.iterator; |
| 607 for (int i = 0; i < start; i++) { |
| 608 if (!it.moveNext()) { |
| 609 throw new RangeError.range(start, 0, i); |
| 610 } |
| 611 } |
| 612 var list = []; |
| 613 if (end == null) { |
| 614 while (it.moveNext()) list.add(it.current); |
| 615 } else { |
| 616 for (int i = start; i < end; i++) { |
| 617 if (!it.moveNext()) { |
| 618 throw new RangeError.range(end, start, i); |
| 619 } |
| 620 list.add(it.current); |
| 621 } |
| 622 } |
| 623 return Primitives.stringFromCharCodes(list); |
| 624 } |
| 599 } | 625 } |
| 600 | 626 |
| 601 /** | 627 /** |
| 602 * The runes (integer Unicode code points) of a [String]. | 628 * The runes (integer Unicode code points) of a [String]. |
| 603 */ | 629 */ |
| 604 class Runes extends IterableBase<int> { | 630 class Runes extends IterableBase<int> { |
| 605 final String string; | 631 final String string; |
| 606 Runes(this.string); | 632 Runes(this.string); |
| 607 | 633 |
| 608 RuneIterator get iterator => new RuneIterator(string); | 634 RuneIterator get iterator => new RuneIterator(string); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 _position = position - 1; | 808 _position = position - 1; |
| 783 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 809 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
| 784 return true; | 810 return true; |
| 785 } | 811 } |
| 786 } | 812 } |
| 787 _position = position; | 813 _position = position; |
| 788 _currentCodePoint = codeUnit; | 814 _currentCodePoint = codeUnit; |
| 789 return true; | 815 return true; |
| 790 } | 816 } |
| 791 } | 817 } |
| OLD | NEW |