| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 patch class String { | 5 patch class String { |
| 6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) { | 6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) { |
| 7 return _StringBase.createFromCharCodes(charCodes); | 7 return _StringBase.createFromCharCodes(charCodes); |
| 8 } | 8 } |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 if (startIndex == endIndex && endIndex == previousIndex) { | 410 if (startIndex == endIndex && endIndex == previousIndex) { |
| 411 ++startIndex; // empty match, advance and restart | 411 ++startIndex; // empty match, advance and restart |
| 412 continue; | 412 continue; |
| 413 } | 413 } |
| 414 result.add(this._substringUnchecked(previousIndex, match.start)); | 414 result.add(this._substringUnchecked(previousIndex, match.start)); |
| 415 startIndex = previousIndex = endIndex; | 415 startIndex = previousIndex = endIndex; |
| 416 } | 416 } |
| 417 return result; | 417 return result; |
| 418 } | 418 } |
| 419 | 419 |
| 420 List<int> get codeUnits => new CodeUnits(this); | 420 List<int> get codeUnits => new _CodeUnits(this); |
| 421 | 421 |
| 422 Runes get runes => new Runes(this); | 422 Runes get runes => new Runes(this); |
| 423 | 423 |
| 424 String toUpperCase() native "String_toUpperCase"; | 424 String toUpperCase() native "String_toUpperCase"; |
| 425 | 425 |
| 426 String toLowerCase() native "String_toLowerCase"; | 426 String toLowerCase() native "String_toLowerCase"; |
| 427 | 427 |
| 428 // Implementations of Strings methods follow below. | 428 // Implementations of Strings methods follow below. |
| 429 static String join(Iterable<String> strings, String separator) { | 429 static String join(Iterable<String> strings, String separator) { |
| 430 bool first = true; | 430 bool first = true; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 for (int g in groups) { | 606 for (int g in groups) { |
| 607 result.add(group(g)); | 607 result.add(group(g)); |
| 608 } | 608 } |
| 609 return result; | 609 return result; |
| 610 } | 610 } |
| 611 | 611 |
| 612 final int start; | 612 final int start; |
| 613 final String str; | 613 final String str; |
| 614 final String pattern; | 614 final String pattern; |
| 615 } | 615 } |
| 616 |
| 617 /** |
| 618 * An [Iterable] of the UTF-16 code units of a [String] in index order. |
| 619 */ |
| 620 class _CodeUnits extends Object with ListMixin<int>, |
| 621 UnmodifiableListMixin<int> { |
| 622 /** The string that this is the code units of. */ |
| 623 String _string; |
| 624 |
| 625 _CodeUnits(this._string); |
| 626 |
| 627 int get length => _string.length; |
| 628 int operator[](int i) => _string.codeUnitAt(i); |
| 629 } |
| OLD | NEW |