samecase
ErrorsCollection

samecase

Synthesised documentation from type/Allomorph type/Cool type/Str

From type/Allomorph

See Original text in context

method samecase(Allomorph:D: |c)

Calls Str.samecase on the invocant's Str value.

From type/Cool

See Original text in context

sub samecase(Cool $stringCool $pattern)
method samecase(Cool:D: Cool $pattern)

Coerces the invocant (or in sub form, the first argument) to Str, and calls Str.samecase on it.

say "raKu".samecase("A_a_"); # OUTPUT: «Raku␤» 
say "rAKU".samecase("Ab");   # OUTPUT: «Raku␤»

From type/Str

See Original text in context

multi method samecase(Str:D: Str:D $pattern --> Str:D)

Returns a copy of the invocant 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 the invocant is longer than $pattern, the case information from the last character of $pattern is applied to the remaining characters of the invocant.

say "raKu".samecase("A_a_"); # OUTPUT: «Raku␤» 
say "rAKU".samecase("Ab");   # OUTPUT: «Raku␤»