Skip to content

Commit f3e8184

Browse files
author
Jan-Olof Hendig
committed
Added documentation for samecase. [Coke]++ for reviewing.
1 parent 46f8d06 commit f3e8184

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

doc/Type/Cool.pod

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,29 @@ With a customer filter too:
10091009
say "have fun working on perl".wordcase(:filter(&uc), :where({ .chars > 3 }));
10101010
# HAVE fun WORKING on PERL
10111011
1012+
=head2 routine samecase
1013+
1014+
Defined as:
1015+
1016+
sub samecase(Cool $string, Cool $pattern)
1017+
method samecase(Cool:D: Cool $pattern)
1018+
1019+
Usage:
1020+
1021+
samecase STRING, PATTERN
1022+
STRING.samecase(PATTERN)
1023+
1024+
Coerces the invocant (or in sub form, the first argument) to L<Str|/type/Str>, and returns a
1025+
copy of C<$string> with case information for each individual character changed according to C<$pattern>.
1026+
(The pattern string can contain three types of characters, i.e. uppercase, lowercase and caseless.
1027+
For a given character in C<$pattern> its case information determines the case of the corresponding
1028+
character in the result.)
1029+
If C<$string> is longer than C<$pattern>, the case information from the last character of
1030+
C<$pattern> is applied to the remaining characters of C<$string>.
1031+
1032+
say "perL 6".samecase("A__a__"); # Perl 6
1033+
say "pERL 6".samecase("Ab"); # Perl 6
1034+
10121035
=head2 routine uniname
10131036
10141037
Defined as:

0 commit comments

Comments
 (0)