1toupper(3)                 Library Functions Manual                 toupper(3)
2
3
4

NAME

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

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

49       The value returned is that of the converted letter, or c if the conver‐
50       sion was not possible.
51

ATTRIBUTES

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

STANDARDS

64       toupper()
65       tolower()
66              C11, POSIX.1-2008.
67
68       toupper_l()
69       tolower_l()
70              POSIX.1-2008.
71

HISTORY

73       toupper()
74       tolower()
75              C89, 4.3BSD, POSIX.1-2001.
76
77       toupper_l()
78       tolower_l()
79              POSIX.1-2008.
80

NOTES

82       The standards require that the argument c for these functions is either
83       EOF or a value that is representable in the type unsigned char.  If the
84       argument c is of type char, it must be cast to unsigned char, as in the
85       following example:
86
87           char c;
88           ...
89           res = toupper((unsigned char) c);
90
91       This is necessary because char may be the equivalent  signed  char,  in
92       which  case a byte where the top bit is set would be sign extended when
93       converting to int, yielding a value that is outside the  range  of  un‐
94       signed char.
95
96       The details of what constitutes an uppercase or lowercase letter depend
97       on the locale.  For example, the default "C" locale does not know about
98       umlauts, so no conversion is done for them.
99
100       In some non-English locales, there are lowercase letters with no corre‐
101       sponding uppercase equivalent; the German sharp s is one example.
102

SEE ALSO

104       isalpha(3), newlocale(3), setlocale(3), towlower(3), towupper(3),  use‐
105       locale(3), locale(7)
106
107
108
109Linux man-pages 6.05              2023-07-20                        toupper(3)
Impressum