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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 throw new UnsupportedError( | 507 throw new UnsupportedError( |
508 "_OneByteString can only be allocated by the VM"); | 508 "_OneByteString can only be allocated by the VM"); |
509 } | 509 } |
510 | 510 |
511 int get hashCode native "String_getHashCode"; | 511 int get hashCode native "String_getHashCode"; |
512 | 512 |
513 // Checks for one-byte whitespaces only. | 513 // Checks for one-byte whitespaces only. |
514 bool _isWhitespace(int codePoint) { | 514 bool _isWhitespace(int codePoint) { |
515 return | 515 return |
516 (codePoint == 32) || // Space. | 516 (codePoint == 32) || // Space. |
517 ((9 <= codePoint) && (codePoint <= 13)) || // CR, LF, TAB, etc. | 517 ((9 <= codePoint) && (codePoint <= 13)) || // CR, LF, TAB, etc. |
518 (codePoint == 0xA0); // NBSP. | 518 (codePoint == 0xA0); // NBSP. |
519 } | 519 } |
520 | 520 |
521 String _substringUncheckedNative(int startIndex, int endIndex) | 521 String _substringUncheckedNative(int startIndex, int endIndex) |
522 native "OneByteString_substringUnchecked"; | 522 native "OneByteString_substringUnchecked"; |
523 | 523 |
524 List<String> _splitWithCharCode(int charCode) | 524 List<String> _splitWithCharCode(int charCode) |
525 native "OneByteString_splitWithCharCode"; | 525 native "OneByteString_splitWithCharCode"; |
526 | 526 |
527 List<String> split(Pattern pattern) { | 527 List<String> split(Pattern pattern) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 class _CodeUnits extends Object with ListMixin<int>, | 710 class _CodeUnits extends Object with ListMixin<int>, |
711 UnmodifiableListMixin<int> { | 711 UnmodifiableListMixin<int> { |
712 /** The string that this is the code units of. */ | 712 /** The string that this is the code units of. */ |
713 String _string; | 713 String _string; |
714 | 714 |
715 _CodeUnits(this._string); | 715 _CodeUnits(this._string); |
716 | 716 |
717 int get length => _string.length; | 717 int get length => _string.length; |
718 int operator[](int i) => _string.codeUnitAt(i); | 718 int operator[](int i) => _string.codeUnitAt(i); |
719 } | 719 } |
OLD | NEW |