@@ -192,19 +192,29 @@ Examples:
192
192
multi method split(Str:D $input: Str:D $delimiter, $limit = Inf, :$all) returns Positional
193
193
multi method split(Str:D $input: Regex:D $delimiter, $limit = Inf, :$all) returns Positional
194
194
195
+ Usage:
196
+
197
+ split( DELIMITER, EXPR [, LIMIT] [, :all])
198
+ split( PATTERN, EXPR [, LIMIT] [, :all])
199
+ EXPR.split( DELIMITER [, LIMIT] [, :all])
200
+ EXPR.split( PATTERN [, LIMIT] [, :all])
201
+
195
202
Splits a string up into pieces based on delimiters found in the string.
196
203
197
- If C < $delimiter > is a string, it is searched for literally and not treated
204
+ If C < DELIMITER > is a string, it is searched for literally and not treated
198
205
as a regex.
199
206
200
- If the named parameter C < :all > is passed, the matches from C < $delimiter >
207
+ If the named parameter C < :all > is passed, the matches from C < DELIMITER >
201
208
are included in the result list.
202
209
203
210
Note that unlike in Perl 5, empty chunks are not removed from the result list.
204
211
If you want that behavior, consider using L < comb > instead.
205
212
213
+ = comment TODO Describe behavior of LIMIT
214
+
206
215
Examples:
207
216
217
+ = begin code
208
218
say split(';', "a;b;c").perl; # ("a", "b", "c").list
209
219
say split(';', "a;b;c", :all).perl; # (("a", ";"), ("b", ";"), "c").list
210
220
say split(';', "a;b;c", 2).perl; # ("a", "b;c").list
@@ -213,6 +223,7 @@ Examples:
213
223
say split(';', "a;b;c,d").perl; # ("a", "b", "c,d").list
214
224
say split(/\;/, "a;b;c,d").perl; # ("a", "b", "c,d").list
215
225
say split(/<[;,]>/, "a;b;c,d").perl; # ("a", "b", "c", "d").list
226
+ = end code
216
227
217
228
= head2 routine comb
218
229
0 commit comments