Last active
April 18, 2016 19:05
-
-
Save dogbert17/669dbab640ad74ec98ce3451a17428e8 to your computer and use it in GitHub Desktop.
Newbie attempt at creating documentation for the samecase method. Some inspiration from http://search.cpan.org/~moritz/Perl6-Str-v0.0.5/lib/Perl6/Str.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 routine samecase | |
Defined as: | |
sub samecase(Cool $string, Cool $pattern) | |
method samecase(Cool:D: Cool $pattern) | |
Usage: | |
samecase STRING, PATTERN | |
STRING.samecase(PATTERN) | |
Coerces the invocant (or in sub form, the first argument) to L<Str|/type/Str>, and returns a | |
copy of $string with case information for each individual character changed according to $pattern. | |
(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__"); # Perl 6 | |
say "pERL 6".samecase("Ab"); # Perl 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment