| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
| 6 * [StringBase] contains common methods used by concrete String implementations, | 6 * [StringBase] contains common methods used by concrete String implementations, |
| 7 * e.g., OneByteString. | 7 * e.g., OneByteString. |
| 8 */ | 8 */ |
| 9 class StringBase { | 9 class StringBase { |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 for (int index = fromIndex; index >= 0; index--) { | 129 for (int index = fromIndex; index >= 0; index--) { |
| 130 if (this.substringMatches(index, other)) { | 130 if (this.substringMatches(index, other)) { |
| 131 return index; | 131 return index; |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 return -1; | 134 return -1; |
| 135 } | 135 } |
| 136 | 136 |
| 137 String substring(int startIndex, [int endIndex]) { | 137 String substring(int startIndex, [int endIndex]) { |
| 138 if (endIndex == null) endIndex = this.length; | 138 if (endIndex === null) endIndex = this.length; |
| 139 | 139 |
| 140 if ((startIndex < 0) || (startIndex > this.length)) { | 140 if ((startIndex < 0) || (startIndex > this.length)) { |
| 141 throw new IndexOutOfRangeException(startIndex); | 141 throw new IndexOutOfRangeException(startIndex); |
| 142 } | 142 } |
| 143 if ((endIndex < 0) || (endIndex > this.length)) { | 143 if ((endIndex < 0) || (endIndex > this.length)) { |
| 144 throw new IndexOutOfRangeException(endIndex); | 144 throw new IndexOutOfRangeException(endIndex); |
| 145 } | 145 } |
| 146 if (startIndex > endIndex) { | 146 if (startIndex > endIndex) { |
| 147 throw new IndexOutOfRangeException(startIndex); | 147 throw new IndexOutOfRangeException(startIndex); |
| 148 } | 148 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 for (int g in groups) { | 435 for (int g in groups) { |
| 436 result.add(group(g)); | 436 result.add(group(g)); |
| 437 } | 437 } |
| 438 return result; | 438 return result; |
| 439 } | 439 } |
| 440 | 440 |
| 441 final int _start; | 441 final int _start; |
| 442 final String str; | 442 final String str; |
| 443 final String pattern; | 443 final String pattern; |
| 444 } | 444 } |
| OLD | NEW |