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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 List<int> get charCodes { | 427 List<int> get charCodes { |
428 int len = this.length; | 428 int len = this.length; |
429 final result = new List<int>.fixedLength(len); | 429 final result = new List<int>.fixedLength(len); |
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 => new CodeUnits(this); |
437 throw new UnimplementedError("String.codeUnits"); | |
438 } | |
439 | 437 |
440 Runes get runes => new Runes(this); | 438 Runes get runes => new Runes(this); |
441 | 439 |
442 String toUpperCase() native "String_toUpperCase"; | 440 String toUpperCase() native "String_toUpperCase"; |
443 | 441 |
444 String toLowerCase() native "String_toLowerCase"; | 442 String toLowerCase() native "String_toLowerCase"; |
445 | 443 |
446 // Implementations of Strings methods follow below. | 444 // Implementations of Strings methods follow below. |
447 static String join(Iterable<String> strings, String separator) { | 445 static String join(Iterable<String> strings, String separator) { |
448 bool first = true; | 446 bool first = true; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 for (int g in groups) { | 620 for (int g in groups) { |
623 result.add(group(g)); | 621 result.add(group(g)); |
624 } | 622 } |
625 return result; | 623 return result; |
626 } | 624 } |
627 | 625 |
628 final int start; | 626 final int start; |
629 final String str; | 627 final String str; |
630 final String pattern; | 628 final String pattern; |
631 } | 629 } |
OLD | NEW |