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 part of dart._js_helper; | 5 part of dart._js_helper; |
6 | 6 |
7 int stringIndexOfStringUnchecked(receiver, other, startIndex) { | 7 int stringIndexOfStringUnchecked(receiver, other, startIndex) { |
8 return JS('int', '#.indexOf(#, #)', receiver, other, startIndex); | 8 return JS('int', '#.indexOf(#, #)', receiver, other, startIndex); |
9 } | 9 } |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 final int start; | 47 final int start; |
48 final String input; | 48 final String input; |
49 final String pattern; | 49 final String pattern; |
50 } | 50 } |
51 | 51 |
52 Iterable<Match> allMatchesInStringUnchecked(String pattern, String string, | 52 Iterable<Match> allMatchesInStringUnchecked(String pattern, String string, |
53 int startIndex) { | 53 int startIndex) { |
54 return new _StringAllMatchesIterable(string, pattern, startIndex); | 54 return new _StringAllMatchesIterable(string, pattern, startIndex); |
55 } | 55 } |
56 | 56 |
57 class _StringAllMatchesIterable extends IterableBase<Match> { | 57 class _StringAllMatchesIterable extends Iterable<Match> { |
58 final String _input; | 58 final String _input; |
59 final String _pattern; | 59 final String _pattern; |
60 final int _index; | 60 final int _index; |
61 | 61 |
62 _StringAllMatchesIterable(this._input, this._pattern, this._index); | 62 _StringAllMatchesIterable(this._input, this._pattern, this._index); |
63 | 63 |
64 Iterator<Match> get iterator => | 64 Iterator<Match> get iterator => |
65 new _StringAllMatchesIterator(_input, _pattern, _index); | 65 new _StringAllMatchesIterator(_input, _pattern, _index); |
66 | 66 |
67 Match get first { | 67 Match get first { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 String stringJoinUnchecked(array, separator) { | 292 String stringJoinUnchecked(array, separator) { |
293 return JS('String', r'#.join(#)', array, separator); | 293 return JS('String', r'#.join(#)', array, separator); |
294 } | 294 } |
295 | 295 |
296 String stringReplaceRangeUnchecked(String receiver, | 296 String stringReplaceRangeUnchecked(String receiver, |
297 int start, int end, String replacement) { | 297 int start, int end, String replacement) { |
298 var prefix = JS('String', '#.substring(0, #)', receiver, start); | 298 var prefix = JS('String', '#.substring(0, #)', receiver, start); |
299 var suffix = JS('String', '#.substring(#)', receiver, end); | 299 var suffix = JS('String', '#.substring(#)', receiver, end); |
300 return "$prefix$replacement$suffix"; | 300 return "$prefix$replacement$suffix"; |
301 } | 301 } |
OLD | NEW |