routine samecase
Documentation for routine samecase
assembled from the following types:
class Cool
From Cool
(Cool) routine samecase
Defined as:
sub samecase(Cool , Cool )method samecase(Cool: Cool )
Coerces the invocant (or in sub form, the first argument) to Str, and returns a copy of $string
with case information for each individual character changed according to $pattern
.
Note: The pattern string can contain three types of characters, i.e. uppercase, lowercase and caseless. For a given character in $pattern
its case information determines the case of the corresponding character in the result.
If $string
is longer than $pattern
, the case information from the last character of $pattern
is applied to the remaining characters of $string
.
say "perL 6".samecase("A__a__"); # OUTPUT: «Perl 6»say "pERL 6".samecase("Ab"); # OUTPUT: «Perl 6»