| 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 const int _maxAscii = 0x7f; | 5 const int _maxAscii = 0x7f; |
| 6 const int _maxLatin1 = 0xff; | 6 const int _maxLatin1 = 0xff; |
| 7 const int _maxUtf16 = 0xffff; | 7 const int _maxUtf16 = 0xffff; |
| 8 const int _maxUnicode = 0x10ffff; | 8 const int _maxUnicode = 0x10ffff; |
| 9 | 9 |
| 10 patch class String { | 10 patch class String { |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 if (startIndex == endIndex && endIndex == previousIndex) { | 877 if (startIndex == endIndex && endIndex == previousIndex) { |
| 878 ++startIndex; // empty match, advance and restart | 878 ++startIndex; // empty match, advance and restart |
| 879 continue; | 879 continue; |
| 880 } | 880 } |
| 881 result.add(this._substringUnchecked(previousIndex, match.start)); | 881 result.add(this._substringUnchecked(previousIndex, match.start)); |
| 882 startIndex = previousIndex = endIndex; | 882 startIndex = previousIndex = endIndex; |
| 883 } | 883 } |
| 884 return result; | 884 return result; |
| 885 } | 885 } |
| 886 | 886 |
| 887 List<int> get codeUnits => new _CodeUnits(this); | 887 List<int> get codeUnits => new CodeUnits(this); |
| 888 | 888 |
| 889 Runes get runes => new Runes(this); | 889 Runes get runes => new Runes(this); |
| 890 | 890 |
| 891 String toUpperCase() native "String_toUpperCase"; | 891 String toUpperCase() native "String_toUpperCase"; |
| 892 | 892 |
| 893 String toLowerCase() native "String_toLowerCase"; | 893 String toLowerCase() native "String_toLowerCase"; |
| 894 | 894 |
| 895 // Concatenate ['start', 'end'[ elements of 'strings'. 'strings' must contain | 895 // Concatenate ['start', 'end'[ elements of 'strings'. 'strings' must contain |
| 896 // String elements. TODO(srdjan): optimize it. | 896 // String elements. TODO(srdjan): optimize it. |
| 897 static String _concatRange(List<String> strings, int start, int end) { | 897 static String _concatRange(List<String> strings, int start, int end) { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 for (int g in groups) { | 1264 for (int g in groups) { |
| 1265 result.add(group(g)); | 1265 result.add(group(g)); |
| 1266 } | 1266 } |
| 1267 return result; | 1267 return result; |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 final int start; | 1270 final int start; |
| 1271 final String input; | 1271 final String input; |
| 1272 final String pattern; | 1272 final String pattern; |
| 1273 } | 1273 } |
| 1274 | |
| 1275 /** | |
| 1276 * An [Iterable] of the UTF-16 code units of a [String] in index order. | |
| 1277 */ | |
| 1278 class _CodeUnits extends Object with ListMixin<int>, | |
| 1279 UnmodifiableListMixin<int> { | |
| 1280 /** The string that this is the code units of. */ | |
| 1281 String _string; | |
| 1282 | |
| 1283 _CodeUnits(this._string); | |
| 1284 | |
| 1285 int get length => _string.length; | |
| 1286 int operator[](int i) => _string.codeUnitAt(i); | |
| 1287 } | |
| OLD | NEW |