Documentation for sub wordcase

Documentation for sub wordcase, assembled from the following types:

class Cool

From Cool

(Cool) routine wordcase

Defined as:

sub wordcase(Str(Cool$input:&filter = &tclcMu :$where = True)
method wordcase(:&filter = &tclcMu :$where = True)

Coerces the invocant (or in sub form, the first argument) to Str, and filters each word that smart-matches 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 "perl 6 programming".wordcase;      # OUTPUT: «Perl 6 Programming␤» 

With a matcher:

say "have fun working on perl".wordcase(:where({ .chars > 3 }));
                                        # Have fun Working on Perl 

With a customer filter too:

say "have fun working on perl".wordcase(:filter(&uc), :where({ .chars > 3 }));
                                        # HAVE fun WORKING on PERL 

class Str

From Str

(Str) routine wordcase

multi sub    wordcase(Cool $x  --> Str)
multi sub    wordcase(Str:D $x --> Str)
multi method wordcase(Str:D: :&filter = &tclcMu :$where = 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.