| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 * | 118 * |
| 119 * Creating a String with half of a surrogate pair is legal but generally | 119 * Creating a String with half of a surrogate pair is legal but generally |
| 120 * discouraged. | 120 * discouraged. |
| 121 */ | 121 */ |
| 122 factory String.fromCharCode(int charCode) { | 122 factory String.fromCharCode(int charCode) { |
| 123 List<int> charCodes = new List<int>.filled(1, charCode); | 123 List<int> charCodes = new List<int>.filled(1, charCode); |
| 124 return new String.fromCharCodes(charCodes); | 124 return new String.fromCharCodes(charCodes); |
| 125 } | 125 } |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * Returns the string for the given environment variable [name] or |
| 129 * [defaultValue] if [name] is not present. |
| 130 */ |
| 131 external const factory String.fromEnvironment(String name, |
| 132 {String defaultValue}); |
| 133 |
| 134 /** |
| 128 * Gets the character (as a single-code-unit [String]) at the given [index]. | 135 * Gets the character (as a single-code-unit [String]) at the given [index]. |
| 129 * | 136 * |
| 130 * The returned string represents exactly one UTF-16 code unit, which may be | 137 * The returned string represents exactly one UTF-16 code unit, which may be |
| 131 * half of a surrogate pair. A single member of a surrogate pair is an | 138 * half of a surrogate pair. A single member of a surrogate pair is an |
| 132 * invalid UTF-16 string: | 139 * invalid UTF-16 string: |
| 133 * | 140 * |
| 134 * var clef = '\u{1D11E}'; | 141 * var clef = '\u{1D11E}'; |
| 135 * // These represent invalid UTF-16 strings. | 142 * // These represent invalid UTF-16 strings. |
| 136 * clef[0].codeUnits; // [0xD834] | 143 * clef[0].codeUnits; // [0xD834] |
| 137 * clef[1].codeUnits; // [0xDD1E] | 144 * clef[1].codeUnits; // [0xDD1E] |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 _position = position - 1; | 656 _position = position - 1; |
| 650 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 657 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
| 651 return true; | 658 return true; |
| 652 } | 659 } |
| 653 } | 660 } |
| 654 _position = position; | 661 _position = position; |
| 655 _currentCodePoint = codeUnit; | 662 _currentCodePoint = codeUnit; |
| 656 return true; | 663 return true; |
| 657 } | 664 } |
| 658 } | 665 } |
| OLD | NEW |