Skip to content

Commit e54be5a

Browse files
committed
Merge pull request #325 from perl6/MARTIMM-patch-4
Add method info to trans (Closes #319)
2 parents d2b00f6 + f249036 commit e54be5a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

doc/Type/Str.pod

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,15 @@ Example:
684684
685685
=head2 method trans
686686
687-
Replaces one or many substrings with one or many strings. Ranges are supported, both for keys and values. Regexes work as keys. When called with C<:complemet> anything but the matched value or range is replaced with a single value. With C<:delete> the matched characters are removed. Combining C<:complement> and C<:delete> will remove anything but the mached values. The adverb C<:squash> will reduce repeated matched characters to a single character.
687+
proto method trans(|) { $/ := nqp::getlexcaller('$/'); {*} }
688+
multi method trans(Str:D: Pair:D \what, *%n) returns Str
689+
multi method trans(Str:D: *@changes, :complement(:$c), :squash(:$s), :delete(:$d)) returns Str
690+
691+
Replaces one or many substrings with one or many strings. Ranges are supported, both for keys and
692+
values. Regexes work as keys. When called with C<:complement> anything but the matched value or range
693+
is replaced with a single value. With C<:delete> the matched characters are removed.
694+
Combining C<:complement> and C<:delete> will remove anything but the mached values.
695+
The adverb C<:squash> will reduce repeated matched characters to a single character.
688696
689697
Example:
690698

0 commit comments

Comments
 (0)