Skip to content

Commit 921fd3c

Browse files
committed
clarify section "routine chop" and expand acc. to roast S32-str/chop.t
1 parent 2676b46 commit 921fd3c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

doc/Type/Str.rakudoc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ L<immutable|/language/faq#If_Str_is_immutable,_how_does_s///_work?_If_Int_is_imm
1414
=head2 routine chop
1515

1616
multi method chop(Str:D:)
17-
multi method chop(Str:D: Int() $chopping)
17+
multi method chop(Str:D: Int() $n)
1818

19-
Returns the string with C<$chopping> characters removed from the end.
19+
Returns the string with C<$n> characters removed from the end.
20+
The original string is left unchanged.
21+
The C<$n> positional is converted to L<C<Int>|/type/Int>
22+
beforehand.
2023

2124
say "Whateverable".chop(3.6); # OUTPUT: «Whatevera␤»
2225
my $string= "Whateverable";
2326
say $string.chop("3"); # OUTPUT: «Whatevera␤»
2427

25-
The C<$chopping> positional is converted to L<C<Int>|/type/Int> before being applied to the
26-
string.
28+
Calls without an argument remove just one character.
29+
If the string contains fewer characters than are to be chopped,
30+
the result is the empty string.
2731

2832
=head2 routine chomp
2933

0 commit comments

Comments
 (0)