Skip to content

Commit 280bb5b

Browse files
committed
Document a few more method in Cool
1 parent 97c24a5 commit 280bb5b

File tree

1 file changed

+62
-2
lines changed

1 file changed

+62
-2
lines changed

lib/Type/Cool.pod

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,64 @@ leading and trailing whitespace stripped.
414414
my $stripped = ' abc '.trim-trailing;
415415
say "<$stripped>"; # < abc>
416416
417+
=head2 method lc
418+
419+
method lc()
420+
421+
Coerces the invocant to L<Str|/type/Str>, and returns it case-folded to lower
422+
case.
423+
424+
say "ABC".lc; # abc
425+
426+
=head2 method uc
427+
428+
method uc()
429+
430+
Coerces the invocant to L<Str|/type/Str>, and returns it case-folded to upper
431+
case (capital letters).
432+
433+
say "Abc".uc; # ABC
434+
435+
=head2 method tc
436+
437+
method tc()
438+
439+
Coerces the invocant to L<Str|/type/Str>, and returns it with the first letter
440+
case-folded to title case (or where not available, upper case).
441+
442+
say "abC".tc; # AbC
443+
444+
=head2 method tclc
445+
446+
method tclc()
447+
448+
Coerces the invocant to L<Str|/type/Str>, and returns it with the first letter
449+
case-folded to title case (or where not available, upper case), and the rest
450+
of the string case-folded to lower case..
451+
452+
say 'abC'.tclc; # Abc
453+
454+
=head2 method wordcase
455+
456+
method wordcase(:&filter = &tclc, Mu :$where = True)
457+
458+
Coerces the invocant to L<Str|/type/Str>, and filters each word that
459+
smart-matches against C<$where> through the C<&filter>. With the default
460+
filter (first character to upper case, rest to lower) and matcher (which
461+
accepts everything), this title-cases each word:
462+
463+
say "perl 6 programming".wordcase; # Perl 6 Programming
464+
465+
With a mather:
466+
467+
say "have fun working on perl".wordcase(:where({ .chars > 3 }));
468+
# Have fun Working on Perl
469+
470+
With a customer filter too:
471+
472+
say "have fun working on perl".wordcase(:filter(&uc), :where({ .chars > 3 }));
473+
# HAVE fun WORKING on PERL
474+
417475
=head2 method IO
418476
419477
method IO() returns IO::Path:D
@@ -425,11 +483,13 @@ Coerces the invocant to L<IO::Path>.
425483
=begin comment
426484
427485
TODO: sech, asech, cosech, acosech, cotanh, acotanh, cis, roots, log10,
428-
unpolar, truncate, fmt, substr, substr-rw, uc, lc, tc,
429-
tclc, wordcase, chomp, chop, chrs, trans, index, rindex, ords,
486+
unpolar, truncate, fmt, substr, substr-rw,
487+
chomp, chop, chrs, trans, index, rindex, ords,
430488
split, match, comb, lines, words, subst, sprintf, printf, samecase,
431489
EVAL
432490
491+
TODO: subroutine forms (where they exist)
492+
433493
=end comment
434494
435495
=end pod

0 commit comments

Comments
 (0)