| 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 | 128 * Returns the string value of the environment declaration [name]. |
| 129 * [defaultValue] if [name] is not present. | 129 * |
| 130 * Environment declarations are provided by the surrounding system compiling |
| 131 * or running the Dart program. Declarations map a string key to a string |
| 132 * value. |
| 133 * |
| 134 * If [name] is not declared in the environment, the result is instead |
| 135 * [defaultValue]. |
| 136 * |
| 137 * Example of getting a value: |
| 138 * |
| 139 * const String.fromEnvironment("defaultFloo", defaultValue: "no floo") |
| 140 * |
| 141 * Example of checking whether a declaration is there at all: |
| 142 * |
| 143 * var isDeclared = const String.fromEnvironment("maybeDeclared") != null; |
| 130 */ | 144 */ |
| 131 external const factory String.fromEnvironment(String name, | 145 external const factory String.fromEnvironment(String name, |
| 132 {String defaultValue}); | 146 {String defaultValue}); |
| 133 | 147 |
| 134 /** | 148 /** |
| 135 * Gets the character (as a single-code-unit [String]) at the given [index]. | 149 * Gets the character (as a single-code-unit [String]) at the given [index]. |
| 136 * | 150 * |
| 137 * The returned string represents exactly one UTF-16 code unit, which may be | 151 * The returned string represents exactly one UTF-16 code unit, which may be |
| 138 * half of a surrogate pair. A single member of a surrogate pair is an | 152 * half of a surrogate pair. A single member of a surrogate pair is an |
| 139 * invalid UTF-16 string: | 153 * invalid UTF-16 string: |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 _position = position - 1; | 670 _position = position - 1; |
| 657 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 671 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
| 658 return true; | 672 return true; |
| 659 } | 673 } |
| 660 } | 674 } |
| 661 _position = position; | 675 _position = position; |
| 662 _currentCodePoint = codeUnit; | 676 _currentCodePoint = codeUnit; |
| 663 return true; | 677 return true; |
| 664 } | 678 } |
| 665 } | 679 } |
| OLD | NEW |