1TOUPPER(3)                 Linux Programmer's Manual                TOUPPER(3)
2
3
4

NAME

6       toupper, tolower, toupper_l, tolower_l - convert uppercase or lowercase
7

SYNOPSIS

9       #include <ctype.h>
10
11       int toupper(int c);
12       int tolower(int c);
13
14       int toupper_l(int c, locale_t locale);
15       int tolower_l(int c, locale_t locale);
16
17   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19       toupper_l(), tolower_l():
20           Since glibc 2.10:
21               _XOPEN_SOURCE >= 700
22           Before glibc 2.10:
23               _GNU_SOURCE
24

DESCRIPTION

26       These functions convert lowercase letters to uppercase, and vice versa.
27
28       If c is a lowercase letter, toupper() returns its uppercase equivalent,
29       if an uppercase representation exists in the  current  locale.   Other‐
30       wise,  it  returns c.  The toupper_l() function performs the same task,
31       but uses the locale referred to by the locale handle locale.
32
33       If c is an uppercase letter, tolower() returns  its  lowercase  equiva‐
34       lent, if a lowercase representation exists in the current locale.  Oth‐
35       erwise, it returns c.  The tolower_l() function performs the same task,
36       but uses the locale referred to by the locale handle locale.
37
38       If  c  is neither an unsigned char value nor EOF, the behavior of these
39       functions is undefined.
40
41       The behavior of toupper_l() and tolower_l() is undefined if  locale  is
42       the special locale object LC_GLOBAL_LOCALE (see duplocale(3)) or is not
43       a valid locale object handle.
44

RETURN VALUE

46       The value returned is that of the converted letter, or c if the conver‐
47       sion was not possible.
48

ATTRIBUTES

50       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
51       tributes(7).
52
53       ┌────────────────────────────────────────────┬───────────────┬─────────┐
54Interface                                   Attribute     Value   
55       ├────────────────────────────────────────────┼───────────────┼─────────┤
56toupper(), tolower(), toupper_l(),          │ Thread safety │ MT-Safe │
57tolower_l()                                 │               │         │
58       └────────────────────────────────────────────┴───────────────┴─────────┘
59

CONFORMING TO

61       toupper(), tolower(): C89, C99, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
62
63       toupper_l(), tolower_l(): POSIX.1-2008.
64

NOTES

66       The standards require that the argument c for these functions is either
67       EOF or a value that is representable in the type unsigned char.  If the
68       argument c is of type char, it must be cast to unsigned char, as in the
69       following example:
70
71           char c;
72           ...
73           res = toupper((unsigned char) c);
74
75       This is necessary because char may be the equivalent  signed  char,  in
76       which  case a byte where the top bit is set would be sign extended when
77       converting to int, yielding a value that is outside the  range  of  un‐
78       signed char.
79
80       The details of what constitutes an uppercase or lowercase letter depend
81       on the locale.  For example, the default "C" locale does not know about
82       umlauts, so no conversion is done for them.
83
84       In some non-English locales, there are lowercase letters with no corre‐
85       sponding uppercase equivalent; the German sharp s is one example.
86

SEE ALSO

88       isalpha(3), newlocale(3), setlocale(3), towlower(3), towupper(3),  use‐
89       locale(3), locale(7)
90

COLOPHON

92       This  page  is  part of release 5.13 of the Linux man-pages project.  A
93       description of the project, information about reporting bugs,  and  the
94       latest     version     of     this    page,    can    be    found    at
95       https://www.kernel.org/doc/man-pages/.
96
97
98
99GNU                               2021-03-22                        TOUPPER(3)
Impressum