Course of Raku / Regexes and grammars / Regexes / Substitution and replacement / Exercises / Lower-case letters
Solution: Lower-case letters
Here is a possible solution to the task.
Code
my $s = 'RAKU';
$s ~~ tr/A..Z/a..z/;
say $s;🦋 You can find the source code in the file upcase-letters.raku.
Output
rakuComments
tr///maps each character in the first range to the character at the same position in the second.Here the ranges run from the uppercase letters to the lowercase ones, so every uppercase letter is replaced by its lowercase partner — the opposite direction to upper-casing.