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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 * | 99 * |
100 * new String.fromCharCodes([68]); // 'D' | 100 * new String.fromCharCodes([68]); // 'D' |
101 * | 101 * |
102 * If a char-code value is greater than 16-bits, it is decomposed into a | 102 * If a char-code value is greater than 16-bits, it is decomposed into a |
103 * surrogate pair: | 103 * surrogate pair: |
104 * | 104 * |
105 * var clef = new String.fromCharCodes([0x1D11E]); | 105 * var clef = new String.fromCharCodes([0x1D11E]); |
106 * clef.codeUnitAt(0); // 0xD834 | 106 * clef.codeUnitAt(0); // 0xD834 |
107 * clef.codeUnitAt(1); // 0xDD1E | 107 * clef.codeUnitAt(1); // 0xDD1E |
108 * | 108 * |
109 * If [start] and [end] is provided, only the values of [charCodes] | 109 * If [start] is provided, the first `start` elements of `charCodes` are |
110 * at positions from `start` to, but not including, `end`, are used. | 110 * skipped. If `charCodes` has fewer than `start` elements in all, the |
111 * The `start` and `end` values must satisfy | 111 * result is an empty string. The `start` value must be non-negative. |
112 * `0 <= start <= end <= charCodes.length`. | 112 * |
| 113 * If [end] is provided, any elements of `charCodes` after the `end`'th are |
| 114 * ignored. If `charCodes` has fewer than `end` elements, the `end` parameter |
| 115 * has no effect. |
113 */ | 116 */ |
114 external factory String.fromCharCodes(Iterable<int> charCodes, | 117 external factory String.fromCharCodes(Iterable<int> charCodes, |
115 [int start = 0, int end]); | 118 [int start = 0, int end]); |
116 | 119 |
117 /** | 120 /** |
118 * Allocates a new String for the specified [charCode]. | 121 * Allocates a new String for the specified [charCode]. |
119 * | 122 * |
120 * If the [charCode] can be represented by a single UTF-16 code unit, the new | 123 * If the [charCode] can be represented by a single UTF-16 code unit, the new |
121 * string contains a single code unit. Otherwise, the [length] is 2 and | 124 * string contains a single code unit. Otherwise, the [length] is 2 and |
122 * the code units form a surrogate pair. See documentation for | 125 * the code units form a surrogate pair. See documentation for |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 _position = position - 1; | 745 _position = position - 1; |
743 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 746 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
744 return true; | 747 return true; |
745 } | 748 } |
746 } | 749 } |
747 _position = position; | 750 _position = position; |
748 _currentCodePoint = codeUnit; | 751 _currentCodePoint = codeUnit; |
749 return true; | 752 return true; |
750 } | 753 } |
751 } | 754 } |
OLD | NEW |