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