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

Unified Diff: sdk/lib/core/string.dart

Issue 12261009: Added implementation of String.codeUnits. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typos Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/core/string.dart
diff --git a/sdk/lib/core/string.dart b/sdk/lib/core/string.dart
index 3584db51c90a01a204babac9bc8f6d917a9a6025..4e5b95021a64cc00acfcd54e1b87c8d0acf8c26e 100644
--- a/sdk/lib/core/string.dart
+++ b/sdk/lib/core/string.dart
@@ -449,7 +449,6 @@ class RuneIterator implements BiDirectionalIterator<int> {
return string.substring(_position, _nextPosition);
}
-
bool moveNext() {
_position = _nextPosition;
if (_position == string.length) {
@@ -492,3 +491,16 @@ class RuneIterator implements BiDirectionalIterator<int> {
return true;
}
}
+
+/**
+ * An [Iterable] of the UTF-16 code units of a [String] in index order.
+ */
+class CodeUnits extends ListIterable<int> {
+ /** The string that this is the code units of. */
+ String string;
+
+ CodeUnits(this.string);
+
+ int get length => string.length;
+ int elementAt(int i) => string.codeUnitAt(i);
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_string.dart ('k') | tests/corelib/string_codeunits_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698