Course of Raku / Addendum 🆕 / Working with data / Text and strings / Exercises / Title case
Solution: Title case
Here is a possible solution to the task.
Code
my $title = 'the lord of the rings';
say $title.words>>.tc.join(' ');🦋 You can find the source code in the file title-case.raku.
Output
The Lord Of The RingsComments
.tc(“title-case”) capitalises the first letter of a string. The hyper operator>>.tcapplies it to every word at once, and.join(' ')reassembles the sentence.
Course navigation
← Title case | Caesar cipher →