Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: sdk/lib/core/string.dart

Issue 24975002: - Implement a first cut for const String.env in the VM to allow (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/core/int.dart ('k') | tests/corelib/string_env_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 value of the given environment variable [name].
129 * The [defaultValue] is returned if [name] is not present in the environment
130 * or if its value is not a string.
131 */
132 external const factory String.fromEnvironment(String name,
133 {String defaultValue: ''});
134
135 /**
128 * Gets the character (as a single-code-unit [String]) at the given [index]. 136 * Gets the character (as a single-code-unit [String]) at the given [index].
129 * 137 *
130 * The returned string represents exactly one UTF-16 code unit, which may be 138 * 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 139 * half of a surrogate pair. A single member of a surrogate pair is an
132 * invalid UTF-16 string: 140 * invalid UTF-16 string:
133 * 141 *
134 * var clef = '\u{1D11E}'; 142 * var clef = '\u{1D11E}';
135 * // These represent invalid UTF-16 strings. 143 * // These represent invalid UTF-16 strings.
136 * clef[0].codeUnits; // [0xD834] 144 * clef[0].codeUnits; // [0xD834]
137 * clef[1].codeUnits; // [0xDD1E] 145 * clef[1].codeUnits; // [0xDD1E]
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 _position = position - 1; 657 _position = position - 1;
650 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); 658 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
651 return true; 659 return true;
652 } 660 }
653 } 661 }
654 _position = position; 662 _position = position;
655 _currentCodePoint = codeUnit; 663 _currentCodePoint = codeUnit;
656 return true; 664 return true;
657 } 665 }
658 } 666 }
OLDNEW
« no previous file with comments | « sdk/lib/core/int.dart ('k') | tests/corelib/string_env_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698