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 class StringMatch implements Match { | 5 class StringMatch implements Match { |
6 const StringMatch(int this.start, | 6 const StringMatch(int this.start, |
7 String this.str, | 7 String this.str, |
8 String this.pattern); | 8 String this.pattern); |
9 | 9 |
10 int get end => start + pattern.length; | 10 int get end => start + pattern.length; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return stringReplaceJS(receiver, re, to); | 117 return stringReplaceJS(receiver, re, to); |
118 } else { | 118 } else { |
119 checkNull(from); | 119 checkNull(from); |
120 // TODO(floitsch): implement generic String.replace (with patterns). | 120 // TODO(floitsch): implement generic String.replace (with patterns). |
121 throw "String.replace(Pattern) UNIMPLEMENTED"; | 121 throw "String.replace(Pattern) UNIMPLEMENTED"; |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 stringSplitUnchecked(receiver, pattern) { | 125 stringSplitUnchecked(receiver, pattern) { |
126 if (pattern is String) { | 126 if (pattern is String) { |
127 return JS('List', r'#.split(#)', receiver, pattern); | 127 return JS('=List', r'#.split(#)', receiver, pattern); |
128 } else if (pattern is JSSyntaxRegExp) { | 128 } else if (pattern is JSSyntaxRegExp) { |
129 var re = regExpGetNative(pattern); | 129 var re = regExpGetNative(pattern); |
130 return JS('List', r'#.split(#)', receiver, re); | 130 return JS('=List', r'#.split(#)', receiver, re); |
131 } else { | 131 } else { |
132 throw "String.split(Pattern) UNIMPLEMENTED"; | 132 throw "String.split(Pattern) UNIMPLEMENTED"; |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 stringJoinUnchecked(array, separator) { | 136 stringJoinUnchecked(array, separator) { |
137 return JS('String', r'#.join(#)', array, separator); | 137 return JS('String', r'#.join(#)', array, separator); |
138 } | 138 } |
OLD | NEW |