Reverse Word

Run Settings
LanguageRaku
Language Version
Run Command
use Test; sub reverse-word(Str() $str, Str $char where *.chars == 1) { do if $str.index: $char -> Int $i { $str.comb.head($i + 1).sort.join ~ $str.substr: $i + 1 } else { $str } } is my $r1 = "challenge".&reverse-word("e"), "acehllnge", $r1; is my $r2 = "programming".&reverse-word("a"), "agoprrmming", $r2; is my $r3 = "champion".&reverse-word("b"), "champion", $r3;
Editor Settings
Theme
Key bindings
Full width
Lines