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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/js_string.dart

Issue 11280034: Move more methods to the new interceptor scheme (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/lib/js_string.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/lib/js_string.dart (revision 15076)
+++ sdk/lib/_internal/compiler/implementation/lib/js_string.dart (working copy)
@@ -93,4 +93,35 @@
}
return result;
}
+
+ int indexOf(String other, [int start = 0]) {
+ checkNull(other);
+ if (start is !int) throw new ArgumentError(start);
+ if (other is !String) throw new ArgumentError(other);
+ if (start < 0) return -1;
+ return JS('int', r'#.indexOf(#, #)', this, other, start);
+ }
+
+ int lastIndexOf(String other, [int start]) {
+ checkNull(other);
+ if (other is !String) throw new ArgumentError(other);
+ if (start != null) {
+ if (start is !num) throw new ArgumentError(start);
+ if (start < 0) return -1;
+ if (start >= length) {
+ if (other == "") return length;
+ start = length - 1;
+ }
+ } else {
+ start = length - 1;
+ }
+ return stringLastIndexOfUnchecked(this, other, start);
+ }
+
+ bool contains(String other, [int startIndex = 0]) {
+ checkNull(other);
+ return stringContainsUnchecked(this, other, startIndex);
+ }
+
+ bool get isEmpty => length == 0;
}

Powered by Google App Engine
This is Rietveld 408576698