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 * The String class represents sequences of characters. Strings are | 8 * The String class represents sequences of characters. Strings are |
9 * immutable. A string is represented by a sequence of Unicode UTF-16 | 9 * immutable. A string is represented by a sequence of Unicode UTF-16 |
10 * code units accessible through the [codeUnitAt] or the | 10 * code units accessible through the [codeUnitAt] or the |
11 * [codeUnits] members. Their string representation is accessible through | 11 * [codeUnits] members. Their string representation is accessible through |
12 * the index-operator. | 12 * the index-operator. |
13 * | 13 * |
14 * The characters of a string are encoded in UTF-16. Decoding UTF-16, which | 14 * The characters of a string are encoded in UTF-16. Decoding UTF-16, which |
15 * combines surrogate pairs, yields Unicode code points. Following a similar | 15 * combines surrogate pairs, yields Unicode code points. Following a similar |
16 * terminology to Go we use the name "rune" for an integer representing a | 16 * terminology to Go we use the name "rune" for an integer representing a |
17 * Unicode code point. The runes of a string are accessible through the [runes] | 17 * Unicode code point. The runes of a string are accessible through the [runes] |
18 * getter. | 18 * getter. |
19 */ | 19 */ |
20 abstract class String implements Comparable, Pattern { | 20 abstract class String implements Comparable<String>, Pattern { |
21 /** | 21 /** |
22 * Allocates a new String for the specified [charCodes]. | 22 * Allocates a new String for the specified [charCodes]. |
23 * | 23 * |
24 * The [charCodes] can be UTF-16 code units or runes. If a char-code value is | 24 * The [charCodes] can be UTF-16 code units or runes. If a char-code value is |
25 * 16-bit it is copied verbatim. If it is greater than 16 bits it is | 25 * 16-bit it is copied verbatim. If it is greater than 16 bits it is |
26 * decomposed into a surrogate pair. | 26 * decomposed into a surrogate pair. |
27 */ | 27 */ |
28 external factory String.fromCharCodes(Iterable<int> charCodes); | 28 external factory String.fromCharCodes(Iterable<int> charCodes); |
29 | 29 |
30 /** | 30 /** |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 */ | 497 */ |
498 class CodeUnits extends ListIterable<int> { | 498 class CodeUnits extends ListIterable<int> { |
499 /** The string that this is the code units of. */ | 499 /** The string that this is the code units of. */ |
500 String string; | 500 String string; |
501 | 501 |
502 CodeUnits(this.string); | 502 CodeUnits(this.string); |
503 | 503 |
504 int get length => string.length; | 504 int get length => string.length; |
505 int elementAt(int i) => string.codeUnitAt(i); | 505 int elementAt(int i) => string.codeUnitAt(i); |
506 } | 506 } |
OLD | NEW |