Documentation for routine wordcase
assembled from the following pages:
Class: Str §
From Str
(Str) routine wordcase §
multi sub wordcase(Cool --> Str)multi sub wordcase(Str --> Str)multi method wordcase(Str: : = , Mu : = True --> Str)
Returns a string in which &filter
has been applied to all the words that match $where
. By default, this means that the first letter of every word is capitalized, and all the other letters lowercased.
Class: Cool §
From Cool
(Cool) routine wordcase §
Defined as:
sub wordcase(Str(Cool) , : = , Mu : = True)method wordcase(: = , Mu : = True)
Coerces the invocant (or in sub form, the first argument) to Str, and filters each word that smartmatches against $where
through the &filter
. With the default filter (first character to upper case, rest to lower) and matcher (which accepts everything), this title-cases each word:
say "raku programming".wordcase; # OUTPUT: «Raku Programming»
With a matcher:
say "have fun working on raku".wordcase(:where()); # Have fun Working on Raku
With a customer filter too:
say "have fun working on raku".wordcase(:filter(), :where()); # HAVE fun WORKING on RAKU