| Index: compiler/lib/implementation/string.dart
|
| ===================================================================
|
| --- compiler/lib/implementation/string.dart (revision 942)
|
| +++ compiler/lib/implementation/string.dart (working copy)
|
| @@ -47,9 +47,18 @@
|
| return substringMatches(0, other);
|
| }
|
|
|
| - int indexOf(String other, int startIndex) native;
|
| - int lastIndexOf(String other, int fromIndex) native;
|
| + int indexOf(String other, [int startIndex = 0]) {
|
| + return _nativeIndexOf(other, startIndex);
|
| + }
|
|
|
| + int lastIndexOf(String other, [int fromIndex = null]) {
|
| + if (fromIndex === null) fromIndex = length - 1;
|
| + return _nativeLastIndexOf(other, fromIndex);
|
| + }
|
| +
|
| + int _nativeIndexOf(String other, int startIndex) native;
|
| + int _nativeLastIndexOf(String other, int fromIndex) native;
|
| +
|
| bool isEmpty() {
|
| return length == 0;
|
| }
|
| @@ -77,8 +86,7 @@
|
|
|
| String trim() native;
|
|
|
| - bool contains(Pattern pattern, int startIndex) {
|
| - if (startIndex == null) startIndex = 0;
|
| + bool contains(Pattern pattern, [int startIndex = 0]) {
|
| if (startIndex < 0 || startIndex > length) {
|
| throw new IndexOutOfRangeException(startIndex);
|
| }
|
|
|