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

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

Issue 14022007: Move Iterable implementation to collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 * The String class represents sequences of characters. Strings are 8 * The String class represents sequences of characters. Strings are
9 * immutable. A string is represented by a sequence of Unicode UTF-16 9 * immutable. A string is represented by a sequence of Unicode UTF-16
10 * code units accessible through the [codeUnitAt] or the 10 * code units accessible through the [codeUnitAt] or the
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 * If this string is not already all upper case, returns a new string 266 * If this string is not already all upper case, returns a new string
267 * where all characters are made upper case. Returns [:this:] otherwise. 267 * where all characters are made upper case. Returns [:this:] otherwise.
268 */ 268 */
269 // TODO(floitsch): document better. (See EcmaScript for description). 269 // TODO(floitsch): document better. (See EcmaScript for description).
270 String toUpperCase(); 270 String toUpperCase();
271 } 271 }
272 272
273 /** 273 /**
274 * The runes (integer Unicode code points) of a [String]. 274 * The runes (integer Unicode code points) of a [String].
275 */ 275 */
276 class Runes extends Iterable<int> { 276 class Runes extends IterableBase<int> {
277 final String string; 277 final String string;
278 Runes(this.string); 278 Runes(this.string);
279 279
280 RuneIterator get iterator => new RuneIterator(string); 280 RuneIterator get iterator => new RuneIterator(string);
281 281
282 int get last { 282 int get last {
283 if (string.length == 0) { 283 if (string.length == 0) {
284 throw new StateError("No elements."); 284 throw new StateError("No elements.");
285 } 285 }
286 int length = string.length; 286 int length = string.length;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 _position = position - 1; 461 _position = position - 1;
462 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); 462 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
463 return true; 463 return true;
464 } 464 }
465 } 465 }
466 _position = position; 466 _position = position;
467 _currentCodePoint = codeUnit; 467 _currentCodePoint = codeUnit;
468 return true; 468 return true;
469 } 469 }
470 } 470 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698