Chromium Code Reviews| Index: runtime/lib/string.dart |
| =================================================================== |
| --- runtime/lib/string.dart (revision 1518) |
| +++ runtime/lib/string.dart (working copy) |
| @@ -160,7 +160,7 @@ |
| } |
| String trim() { |
| - int len = this.length; |
| + final int len = this.length; |
| int first = 0; |
| for (; first < len; first++) { |
| if (!_isWhitespace(this.charCodeAt(first))) { |
| @@ -177,7 +177,13 @@ |
| break; |
| } |
| } |
| - return substringUnchecked_(first, last + 1); |
| + if ((first == 0) && (last == len - 1)) { |
|
siva
2011/11/14 21:26:17
(len - 1)
srdjan
2011/11/14 22:15:33
Done.
|
| + // Returns this string if it does not have leading or trailing |
| + // whitespaces. |
| + return this; |
| + } else { |
| + return substringUnchecked_(first, last + 1); |
| + } |
| } |
| bool contains(Pattern other, [int startIndex = 0]) { |