@@ -414,6 +414,64 @@ leading and trailing whitespace stripped.
414
414
my $stripped = ' abc '.trim-trailing;
415
415
say "<$stripped>"; # < abc>
416
416
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
+
417
475
= head2 method IO
418
476
419
477
method IO() returns IO::Path:D
@@ -425,11 +483,13 @@ Coerces the invocant to L<IO::Path>.
425
483
= begin comment
426
484
427
485
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,
430
488
split, match, comb, lines, words, subst, sprintf, printf, samecase,
431
489
EVAL
432
490
491
+ TODO: subroutine forms (where they exist)
492
+
433
493
= end comment
434
494
435
495
= end pod
0 commit comments