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 /** | 5 /** |
6 * The String class represents character strings. Strings are | 6 * The String class represents character strings. Strings are |
7 * immutable. A string is represented by a list of 32-bit Unicode | 7 * immutable. A string is represented by a list of 32-bit Unicode |
8 * scalar character codes accessible through the [charCodeAt] or the | 8 * scalar character codes accessible through the [charCodeAt] or the |
9 * [charCodes] method. | 9 * [charCodes] method. |
10 */ | 10 */ |
11 interface String | 11 abstract class String implements Comparable, Pattern, Sequence<String> { |
12 extends Comparable, Pattern, Sequence<String> | |
13 default _StringImpl { | |
14 /** | 12 /** |
15 * Allocates a new String for the specified [charCodes]. | 13 * Allocates a new String for the specified [charCodes]. |
16 */ | 14 */ |
17 String.fromCharCodes(List<int> charCodes); | 15 external factory String.fromCharCodes(List<int> charCodes); |
18 | 16 |
19 /** | 17 /** |
20 * Gets the character (as [String]) at the given [index]. | 18 * Gets the character (as [String]) at the given [index]. |
21 */ | 19 */ |
22 String operator [](int index); | 20 String operator [](int index); |
23 | 21 |
24 /** | 22 /** |
25 * Gets the scalar character code at the given [index]. | 23 * Gets the scalar character code at the given [index]. |
26 */ | 24 */ |
27 int charCodeAt(int index); | 25 int charCodeAt(int index); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 * where all characters are made lower case. Returns [:this:] otherwise. | 122 * where all characters are made lower case. Returns [:this:] otherwise. |
125 */ | 123 */ |
126 String toLowerCase(); | 124 String toLowerCase(); |
127 | 125 |
128 /** | 126 /** |
129 * If this string is not already all uper case, returns a new string | 127 * If this string is not already all uper case, returns a new string |
130 * where all characters are made upper case. Returns [:this:] otherwise. | 128 * where all characters are made upper case. Returns [:this:] otherwise. |
131 */ | 129 */ |
132 String toUpperCase(); | 130 String toUpperCase(); |
133 } | 131 } |
134 | |
135 class _StringImpl { | |
136 /** | |
137 * Factory implementation of String.fromCharCodes: | |
138 * Allocates a new String for the specified [charCodes]. | |
139 */ | |
140 external factory String.fromCharCodes(List<int> charCodes); | |
141 | |
142 /** | |
143 * Joins all the given strings to create a new string. | |
144 */ | |
145 external static String join(List<String> strings, String separator); | |
146 | |
147 /** | |
148 * Concatenates all the given strings to create a new string. | |
149 */ | |
150 external static String concatAll(List<String> strings); | |
151 | |
152 } | |
OLD | NEW |