Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Mention how to capitalize strings
  • Loading branch information
Paul Cochrane committed Feb 26, 2015
1 parent 3b6d55b commit 114c308
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/Language/traps.pod
Expand Up @@ -201,6 +201,26 @@ last element of an array becomes:
my @array = qw{victor alice bob charlie eve};
say @array[*-1]; #=> eve
=head1 Strings
=head2 Capitalizing a string
In Perl 5 one could capitalize a string by using the C<ucfirst> function
say ucfirst "alice"; #=> Alice
The C<ucfirst> function does not exist in Perl 6; one needs to use the
C<tclc> method:
say "alice".tclc; #=> Alice
which is equivalent to
say tclc "alice"; #=> Alice
Here, C<tclc> means "title case for the first character, lower case for the
remaining characters".
=end pod

# vim: expandtab shiftwidth=4 ft=perl6

0 comments on commit 114c308

Please sign in to comment.