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 /* patch */ const factory String.fromEnvironment(String name, | 10 /* patch */ const factory String.fromEnvironment(String name, |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 for (int i = 0; i < this.length; i++) { | 461 for (int i = 0; i < this.length; i++) { |
462 if (string.codeUnitAt(start + i) != this.codeUnitAt(i)) { | 462 if (string.codeUnitAt(start + i) != this.codeUnitAt(i)) { |
463 return null; | 463 return null; |
464 } | 464 } |
465 } | 465 } |
466 return new _StringMatch(start, string, this); | 466 return new _StringMatch(start, string, this); |
467 } | 467 } |
468 | 468 |
469 List<String> split(Pattern pattern) { | 469 List<String> split(Pattern pattern) { |
470 if ((pattern is String) && pattern.isEmpty) { | 470 if ((pattern is String) && pattern.isEmpty) { |
471 List<String> result = new List<String>(length); | 471 List<String> result = new List<String>(this.length); |
472 for (int i = 0; i < length; i++) { | 472 for (int i = 0; i < this.length; i++) { |
473 result[i] = this[i]; | 473 result[i] = this[i]; |
474 } | 474 } |
475 return result; | 475 return result; |
476 } | 476 } |
477 int length = this.length; | 477 int length = this.length; |
478 Iterator iterator = pattern.allMatches(this).iterator; | 478 Iterator iterator = pattern.allMatches(this).iterator; |
479 if (length == 0 && iterator.moveNext()) { | 479 if (length == 0 && iterator.moveNext()) { |
480 // A matched empty string input returns the empty list. | 480 // A matched empty string input returns the empty list. |
481 return <String>[]; | 481 return <String>[]; |
482 } | 482 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 class _CodeUnits extends Object with ListMixin<int>, | 723 class _CodeUnits extends Object with ListMixin<int>, |
724 UnmodifiableListMixin<int> { | 724 UnmodifiableListMixin<int> { |
725 /** The string that this is the code units of. */ | 725 /** The string that this is the code units of. */ |
726 String _string; | 726 String _string; |
727 | 727 |
728 _CodeUnits(this._string); | 728 _CodeUnits(this._string); |
729 | 729 |
730 int get length => _string.length; | 730 int get length => _string.length; |
731 int operator[](int i) => _string.codeUnitAt(i); | 731 int operator[](int i) => _string.codeUnitAt(i); |
732 } | 732 } |
OLD | NEW |