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

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

Issue 515183002: Make String.fromCharCodes take start/end. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't say that end must be greater than start. Passing the actual length should be the same as pass… Created 6 years, 3 months 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
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 * 16-bit, it is copied verbatim: 98 * 16-bit, it is copied verbatim:
99 * 99 *
100 * new String.fromCharCodes([68]); // 'D' 100 * new String.fromCharCodes([68]); // 'D'
101 * 101 *
102 * If a char-code value is greater than 16-bits, it is decomposed into a 102 * If a char-code value is greater than 16-bits, it is decomposed into a
103 * surrogate pair: 103 * surrogate pair:
104 * 104 *
105 * var clef = new String.fromCharCodes([0x1D11E]); 105 * var clef = new String.fromCharCodes([0x1D11E]);
106 * clef.codeUnitAt(0); // 0xD834 106 * clef.codeUnitAt(0); // 0xD834
107 * clef.codeUnitAt(1); // 0xDD1E 107 * clef.codeUnitAt(1); // 0xDD1E
108 *
109 * If [start] is provided, the first `start` elements of `charCodes` are
110 * skipped. If `charCodes` has fewer than `start` elements in all, the
111 * result is an empty string. The `start` value must be non-negative.
112 *
113 * If [end] is provided, any elements of `charCodes` after the `end`'th are
114 * ignored. If `charCodes` has fewer than `end` elements, the `end` parameter
115 * has no effect.
108 */ 116 */
109 external factory String.fromCharCodes(Iterable<int> charCodes); 117 external factory String.fromCharCodes(Iterable<int> charCodes,
118 [int start = 0, int end]);
srdjan 2014/09/17 15:31:59 I assume the library team has agreed to this API c
110 119
111 /** 120 /**
112 * Allocates a new String for the specified [charCode]. 121 * Allocates a new String for the specified [charCode].
113 * 122 *
114 * If the [charCode] can be represented by a single UTF-16 code unit, the new 123 * If the [charCode] can be represented by a single UTF-16 code unit, the new
115 * string contains a single code unit. Otherwise, the [length] is 2 and 124 * string contains a single code unit. Otherwise, the [length] is 2 and
116 * the code units form a surrogate pair. See documentation for 125 * the code units form a surrogate pair. See documentation for
117 * [fromCharCodes]. 126 * [fromCharCodes].
118 * 127 *
119 * Creating a String with half of a surrogate pair is allowed. 128 * Creating a String with half of a surrogate pair is allowed.
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 _position = position - 1; 745 _position = position - 1;
737 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); 746 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
738 return true; 747 return true;
739 } 748 }
740 } 749 }
741 _position = position; 750 _position = position;
742 _currentCodePoint = codeUnit; 751 _currentCodePoint = codeUnit;
743 return true; 752 return true;
744 } 753 }
745 } 754 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698