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

NAME

6       isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph, islower,
7       isprint, ispunct, isspace,  isupper,  isxdigit,  isalnum_l,  isalpha_l,
8       isascii_l,  isblank_l,  iscntrl_l, isdigit_l, isgraph_l, islower_l, is‐
9       print_l, ispunct_l, isspace_l, isupper_l, isxdigit_l - character  clas‐
10       sification functions
11

LIBRARY

13       Standard C library (libc, -lc)
14

SYNOPSIS

16       #include <ctype.h>
17
18       int isalnum(int c);
19       int isalpha(int c);
20       int iscntrl(int c);
21       int isdigit(int c);
22       int isgraph(int c);
23       int islower(int c);
24       int isprint(int c);
25       int ispunct(int c);
26       int isspace(int c);
27       int isupper(int c);
28       int isxdigit(int c);
29
30       int isascii(int c);
31       int isblank(int c);
32
33       int isalnum_l(int c, locale_t locale);
34       int isalpha_l(int c, locale_t locale);
35       int isblank_l(int c, locale_t locale);
36       int iscntrl_l(int c, locale_t locale);
37       int isdigit_l(int c, locale_t locale);
38       int isgraph_l(int c, locale_t locale);
39       int islower_l(int c, locale_t locale);
40       int isprint_l(int c, locale_t locale);
41       int ispunct_l(int c, locale_t locale);
42       int isspace_l(int c, locale_t locale);
43       int isupper_l(int c, locale_t locale);
44       int isxdigit_l(int c, locale_t locale);
45
46       int isascii_l(int c, locale_t locale);
47
48   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
49
50       isascii():
51           _XOPEN_SOURCE
52               || /* glibc >= 2.19: */ _DEFAULT_SOURCE
53               || /* glibc <= 2.19: */ _SVID_SOURCE
54
55       isblank():
56           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
57
58       salnum_l(), salpha_l(), sblank_l(), scntrl_l(), sdigit_l(), sgraph_l(),
59       slower_l(), sprint_l(), spunct_l(), sspace_l(), supper_l(),
60       sxdigit_l():
61           Since glibc 2.10:
62               _XOPEN_SOURCE >= 700
63           Before glibc 2.10:
64               _GNU_SOURCE
65
66       isascii_l():
67           Since glibc 2.10:
68               _XOPEN_SOURCE >= 700 && (_SVID_SOURCE || _BSD_SOURCE)
69           Before glibc 2.10:
70               _GNU_SOURCE
71

DESCRIPTION

73       These  functions  check  whether c, which must have the value of an un‐
74       signed char or EOF, falls into a certain character class  according  to
75       the  specified  locale.   The functions without the "_l" suffix perform
76       the check based on the current locale.
77
78       The functions with the "_l" suffix perform the check based on  the  lo‐
79       cale  specified  by  the  locale  object locale.  The behavior of these
80       functions  is  undefined  if  locale  is  the  special  locale   object
81       LC_GLOBAL_LOCALE  (see  duplocale(3))  or  is not a valid locale object
82       handle.
83
84       The list below explains the operation of the functions without the "_l"
85       suffix; the functions with the "_l" suffix differ only in using the lo‐
86       cale object locale instead of the current locale.
87
88       isalnum()
89              checks for an alphanumeric character; it is equivalent to (isal‐
90              pha(c) || isdigit(c)).
91
92       isalpha()
93              checks  for an alphabetic character; in the standard "C" locale,
94              it is equivalent to (isupper(c) ||  islower(c)).   In  some  lo‐
95              cales, there may be additional characters for which isalpha() is
96              true—letters which are neither uppercase nor lowercase.
97
98       isascii()
99              checks whether c is a 7-bit unsigned char value that  fits  into
100              the ASCII character set.
101
102       isblank()
103              checks for a blank character; that is, a space or a tab.
104
105       iscntrl()
106              checks for a control character.
107
108       isdigit()
109              checks for a digit (0 through 9).
110
111       isgraph()
112              checks for any printable character except space.
113
114       islower()
115              checks for a lowercase character.
116
117       isprint()
118              checks for any printable character including space.
119
120       ispunct()
121              checks  for  any  printable character which is not a space or an
122              alphanumeric character.
123
124       isspace()
125              checks for white-space characters.  In the "C" and  "POSIX"  lo‐
126              cales,  these are: space, form-feed ('\f'), newline ('\n'), car‐
127              riage return ('\r'), horizontal tab  ('\t'),  and  vertical  tab
128              ('\v').
129
130       isupper()
131              checks for an uppercase letter.
132
133       isxdigit()
134              checks for hexadecimal digits, that is, one of
135              0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F.
136

RETURN VALUE

138       The  values  returned  are  nonzero  if  the character c falls into the
139       tested class, and zero if not.
140

ATTRIBUTES

142       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
143       tributes(7).
144
145       ┌────────────────────────────────────────────┬───────────────┬─────────┐
146Interface                                   Attribute     Value   
147       ├────────────────────────────────────────────┼───────────────┼─────────┤
148isalnum(), isalpha(), isascii(), isblank(), │ Thread safety │ MT-Safe │
149iscntrl(), isdigit(), isgraph(), islower(), │               │         │
150isprint(), ispunct(), isspace(), isupper(), │               │         │
151isxdigit()                                  │               │         │
152       └────────────────────────────────────────────┴───────────────┴─────────┘
153

STANDARDS

155       isalnum()
156       isalpha()
157       iscntrl()
158       isdigit()
159       isgraph()
160       islower()
161       isprint()
162       ispunct()
163       isspace()
164       isupper()
165       isxdigit()
166       isblank()
167              C11, POSIX.1-2008.
168
169       isascii()
170       isalnum_l()
171       isalpha_l()
172       isblank_l()
173       iscntrl_l()
174       isdigit_l()
175       isgraph_l()
176       islower_l()
177       isprint_l()
178       ispunct_l()
179       isspace_l()
180       isupper_l()
181       isxdigit_l()
182              POSIX.1-2008.
183
184       isascii_l()
185              GNU.
186

HISTORY

188       isalnum()
189       isalpha()
190       iscntrl()
191       isdigit()
192       isgraph()
193       islower()
194       isprint()
195       ispunct()
196       isspace()
197       isupper()
198       isxdigit()
199              C89, POSIX.1-2001.
200
201       isblank()
202              C99, POSIX.1-2001.
203
204       isascii()
205              POSIX.1-2001 (XSI).
206
207              POSIX.1-2008 marks it as obsolete, noting that it cannot be used
208              portably in a localized application.
209
210       isalnum_l()
211       isalpha_l()
212       isblank_l()
213       iscntrl_l()
214       isdigit_l()
215       isgraph_l()
216       islower_l()
217       isprint_l()
218       ispunct_l()
219       isspace_l()
220       isupper_l()
221       isxdigit_l()
222              glibc 2.3.  POSIX.1-2008.
223
224       isascii_l()
225              glibc 2.3.
226

CAVEATS

228       The standards require that the argument c for these functions is either
229       EOF or a value  that  is  representable  in  the  type  unsigned  char;
230       otherwise,  the  behavior  is  undefined.  If the argument c is of type
231       char, it must be cast to unsigned char, as in the following example:
232
233           char c;
234           ...
235           res = toupper((unsigned char) c);
236
237       This is necessary because char may be the equivalent of signed char, in
238       which  case a byte where the top bit is set would be sign extended when
239       converting to int, yielding a value that is outside the  range  of  un‐
240       signed char.
241
242       The  details of what characters belong to which class depend on the lo‐
243       cale.  For example, isupper() will not recognize an A-umlaut (Ä) as  an
244       uppercase letter in the default C locale.
245

SEE ALSO

247       iswalnum(3),  iswalpha(3),  iswblank(3), iswcntrl(3), iswdigit(3), isw‐
248       graph(3), iswlower(3), iswprint(3),  iswpunct(3),  iswspace(3),  iswup‐
249       per(3),    iswxdigit(3),    newlocale(3),   setlocale(3),   toascii(3),
250       tolower(3), toupper(3), uselocale(3), ascii(7), locale(7)
251
252
253
254Linux man-pages 6.05              2023-07-30                        isalpha(3)
Impressum