Skip to content

Commit 81278cc

Browse files
committed
Added usage to C<split>
Added TODO for LIMIT to C<split> Put code tags around examples in C<split>
1 parent 5d17958 commit 81278cc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/Type/Str.pod

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,29 @@ Examples:
192192
multi method split(Str:D $input: Str:D $delimiter, $limit = Inf, :$all) returns Positional
193193
multi method split(Str:D $input: Regex:D $delimiter, $limit = Inf, :$all) returns Positional
194194
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+
195202
Splits a string up into pieces based on delimiters found in the string.
196203
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
198205
as a regex.
199206
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>
201208
are included in the result list.
202209
203210
Note that unlike in Perl 5, empty chunks are not removed from the result list.
204211
If you want that behavior, consider using L<comb> instead.
205212
213+
=comment TODO Describe behavior of LIMIT
214+
206215
Examples:
207216
217+
=begin code
208218
say split(';', "a;b;c").perl; # ("a", "b", "c").list
209219
say split(';', "a;b;c", :all).perl; # (("a", ";"), ("b", ";"), "c").list
210220
say split(';', "a;b;c", 2).perl; # ("a", "b;c").list
@@ -213,6 +223,7 @@ Examples:
213223
say split(';', "a;b;c,d").perl; # ("a", "b", "c,d").list
214224
say split(/\;/, "a;b;c,d").perl; # ("a", "b", "c,d").list
215225
say split(/<[;,]>/, "a;b;c,d").perl; # ("a", "b", "c", "d").list
226+
=end code
216227
217228
=head2 routine comb
218229

0 commit comments

Comments
 (0)