Skip to content

Commit

Permalink
Simply the uc() and lc() documentation for novices
Browse files Browse the repository at this point in the history
  • Loading branch information
scottchiefbaker committed Jun 2, 2021
1 parent 9085b4e commit bfd4b7e
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions pod/perlfunc.pod
Expand Up @@ -3896,11 +3896,13 @@ X<lc> X<lowercase>

=for Pod::Functions return lower-case version of a string

Returns a lowercased version of EXPR. This is the internal function
implementing the C<\L> escape in double-quoted strings.
Returns a lowercased version of EXPR.

If EXPR is omitted, uses L<C<$_>|perlvar/$_>.

my $str = lc("Perl is GREAT"); # "perl is great"
my $str = lc(undef); # undef

What gets returned depends on several factors:

=over
Expand Down Expand Up @@ -3944,6 +3946,14 @@ Unicode rules are used for the case change.
ASCII rules are used for the case change. The lowercase of any character
outside the ASCII range is the character itself.

=item Note:

This is the internal function implementing the
L<C<\L>|perlop/"Quote and Quote-like Operators"> escape in double-quoted
strings.

my $str = "Perl is \LGREAT\E"; # "Perl is great"

=back

=item lcfirst EXPR
Expand Down Expand Up @@ -9335,16 +9345,27 @@ X<uc> X<uppercase> X<toupper>

=for Pod::Functions return upper-case version of a string

Returns an uppercased version of EXPR. This is the internal function
implementing the C<\U> escape in double-quoted strings.
It does not attempt to do titlecase mapping on initial letters. See
L<C<ucfirst>|/ucfirst EXPR> for that.
Returns an uppercased version of EXPR.

If EXPR is omitted, uses L<C<$_>|perlvar/$_>.

my $str = uc("Perl is GREAT"); # "PERL IS GREAT"
my $str = uc(undef); # undef

This function behaves the same way under various pragmas, such as in a locale,
as L<C<lc>|/lc EXPR> does.

If you want titlecase mapping on initial letters see
L<C<ucfirst>|/ucfirst EXPR> instead.

=item Note:

This is the internal function implementing the
L<C<\U>|perlop/"Quote and Quote-like Operators"> escape in double-quoted
strings.

my $str = "Perl is \Ugreat\E"; # "Perl is GREAT"

=item ucfirst EXPR
X<ucfirst> X<uppercase>

Expand Down

0 comments on commit bfd4b7e

Please sign in to comment.