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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 String operator [](int index) native "String_charAt"; | 63 String operator [](int index) native "String_charAt"; |
64 | 64 |
65 int codeUnitAt(int index) native "String_codeUnitAt"; | 65 int codeUnitAt(int index) native "String_codeUnitAt"; |
66 | 66 |
67 int get length native "String_getLength"; | 67 int get length native "String_getLength"; |
68 | 68 |
69 bool get isEmpty { | 69 bool get isEmpty { |
70 return this.length == 0; | 70 return this.length == 0; |
71 } | 71 } |
72 | 72 |
| 73 bool get isNotEmpty => !isEmpty; |
| 74 |
73 String operator +(String other) native "String_concat"; | 75 String operator +(String other) native "String_concat"; |
74 | 76 |
75 String concat(String other) => this + other; | 77 String concat(String other) => this + other; |
76 | 78 |
77 String toString() { | 79 String toString() { |
78 return this; | 80 return this; |
79 } | 81 } |
80 | 82 |
81 bool operator ==(Object other) { | 83 bool operator ==(Object other) { |
82 if (identical(this, other)) { | 84 if (identical(this, other)) { |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 class _CodeUnits extends Object with ListMixin<int>, | 667 class _CodeUnits extends Object with ListMixin<int>, |
666 UnmodifiableListMixin<int> { | 668 UnmodifiableListMixin<int> { |
667 /** The string that this is the code units of. */ | 669 /** The string that this is the code units of. */ |
668 String _string; | 670 String _string; |
669 | 671 |
670 _CodeUnits(this._string); | 672 _CodeUnits(this._string); |
671 | 673 |
672 int get length => _string.length; | 674 int get length => _string.length; |
673 int operator[](int i) => _string.codeUnitAt(i); | 675 int operator[](int i) => _string.codeUnitAt(i); |
674 } | 676 } |
OLD | NEW |