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 /** | 5 /** |
6 * [_StringBase] contains common methods used by concrete String | 6 * [_StringBase] contains common methods used by concrete String |
7 * implementations, e.g., _OneByteString. | 7 * implementations, e.g., _OneByteString. |
8 */ | 8 */ |
9 class _StringBase { | 9 class _StringBase { |
10 | 10 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 for (int i = 0; i < len; i++) { | 430 for (int i = 0; i < len; i++) { |
431 result[i] = this.charCodeAt(i); | 431 result[i] = this.charCodeAt(i); |
432 } | 432 } |
433 return result; | 433 return result; |
434 } | 434 } |
435 | 435 |
436 Iterable<int> get codeUnits { | 436 Iterable<int> get codeUnits { |
437 throw new UnimplementedError("String.codeUnits"); | 437 throw new UnimplementedError("String.codeUnits"); |
438 } | 438 } |
439 | 439 |
440 Iterable<int> get runes { | 440 Runes get runes => new Runes(this); |
441 throw new UnimplementedError("String.runes"); | |
442 } | |
443 | 441 |
444 String toUpperCase() native "String_toUpperCase"; | 442 String toUpperCase() native "String_toUpperCase"; |
445 | 443 |
446 String toLowerCase() native "String_toLowerCase"; | 444 String toLowerCase() native "String_toLowerCase"; |
447 | 445 |
448 // Implementations of Strings methods follow below. | 446 // Implementations of Strings methods follow below. |
449 static String join(Iterable<String> strings, String separator) { | 447 static String join(Iterable<String> strings, String separator) { |
450 bool first = true; | 448 bool first = true; |
451 List<String> stringsList = <String>[]; | 449 List<String> stringsList = <String>[]; |
452 for (String string in strings) { | 450 for (String string in strings) { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 for (int g in groups) { | 622 for (int g in groups) { |
625 result.add(group(g)); | 623 result.add(group(g)); |
626 } | 624 } |
627 return result; | 625 return result; |
628 } | 626 } |
629 | 627 |
630 final int start; | 628 final int start; |
631 final String str; | 629 final String str; |
632 final String pattern; | 630 final String pattern; |
633 } | 631 } |
OLD | NEW |