Debian Codegraph @

upstream/debian-unstable/man3/isalpha.3

raw
1 '\" t
2 .\" Copyright 1993, Thomas Koenig <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH isalpha 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph, islower,
10 isprint, ispunct, isspace, isupper, isxdigit,
11 isalnum_l, isalpha_l, isascii_l, isblank_l, iscntrl_l,
12 isdigit_l, isgraph_l, islower_l,
13 isprint_l, ispunct_l, isspace_l, isupper_l, isxdigit_l
14 \- character classification functions
15 .SH LIBRARY
16 Standard C library
17 .RI ( libc ,\~ \-lc )
18 .SH SYNOPSIS
19 .nf
20 .B #include <ctype.h>
21 .P
22 .BI "int isalnum(int " c );
23 .BI "int isalpha(int " c );
24 .BI "int iscntrl(int " c );
25 .BI "int isdigit(int " c );
26 .BI "int isgraph(int " c );
27 .BI "int islower(int " c );
28 .BI "int isprint(int " c );
29 .BI "int ispunct(int " c );
30 .BI "int isspace(int " c );
31 .BI "int isupper(int " c );
32 .BI "int isxdigit(int " c );
33 .P
34 .BI "int isascii(int " c );
35 .BI "int isblank(int " c );
36 .P
37 .BI "int isalnum_l(int " c ", locale_t " locale );
38 .BI "int isalpha_l(int " c ", locale_t " locale );
39 .BI "int isblank_l(int " c ", locale_t " locale );
40 .BI "int iscntrl_l(int " c ", locale_t " locale );
41 .BI "int isdigit_l(int " c ", locale_t " locale );
42 .BI "int isgraph_l(int " c ", locale_t " locale );
43 .BI "int islower_l(int " c ", locale_t " locale );
44 .BI "int isprint_l(int " c ", locale_t " locale );
45 .BI "int ispunct_l(int " c ", locale_t " locale );
46 .BI "int isspace_l(int " c ", locale_t " locale );
47 .BI "int isupper_l(int " c ", locale_t " locale );
48 .BI "int isxdigit_l(int " c ", locale_t " locale );
49 .P
50 .BI "int isascii_l(int " c ", locale_t " locale );
51 .fi
52 .P
53 .RS -4
54 Feature Test Macro Requirements for glibc (see
55 .BR feature_test_macros (7)):
56 .RE
57 .ad l
58 .P
59 .BR isascii ():
60 .nf
61 _XOPEN_SOURCE
62 || /* glibc >= 2.19: */ _DEFAULT_SOURCE
63 || /* glibc <= 2.19: */ _SVID_SOURCE
64 .fi
65 .P
66 .BR isblank ():
67 .nf
68 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
69 .fi
70 .P
71 .BR \%isalnum_l (),
72 .BR \%isalpha_l (),
73 .BR \%isblank_l (),
74 .BR \%iscntrl_l (),
75 .BR \%isdigit_l (),
76 .BR \%isgraph_l (),
77 .BR \%islower_l (),
78 .BR \%isprint_l (),
79 .BR \%ispunct_l (),
80 .BR \%isspace_l (),
81 .BR \%isupper_l (),
82 .BR \%isxdigit_l ():
83 .nf
84 Since glibc 2.10:
85 _XOPEN_SOURCE >= 700
86 Before glibc 2.10:
87 _GNU_SOURCE
88 .fi
89 .P
90 .BR isascii_l ():
91 .nf
92 Since glibc 2.10:
93 _XOPEN_SOURCE >= 700 && (_SVID_SOURCE || _BSD_SOURCE)
94 Before glibc 2.10:
95 _GNU_SOURCE
96 .fi
97 .ad
98 .SH DESCRIPTION
99 These functions check whether
100 .IR c ,
101 which must have the value of an
102 .I unsigned char
103 or
104 .BR EOF ,
105 falls into a certain character class according to the specified locale.
106 The functions without the
107 "_l" suffix perform the check based on the current locale.
108 .P
109 The functions with the "_l" suffix perform the check
110 based on the locale specified by the locale object
111 .IR locale .
112 The behavior of these functions is undefined if
113 .I locale
114 is the special locale object
115 .B LC_GLOBAL_LOCALE
116 (see
117 .BR duplocale (3))
118 or is not a valid locale object handle.
119 .P
120 The list below explains the operation of the functions without
121 the "_l" suffix;
122 the functions with the "_l" suffix differ only in using the locale object
123 .I locale
124 instead of the current locale.
125 .TP
126 .BR isalnum ()
127 checks for an alphanumeric character;
128 it is equivalent to
129 .IR "(isalpha(c)\ ||\ isdigit(c))" .
130 .TP
131 .BR isalpha ()
132 checks for an alphabetic character;
133 in the standard
134 .B \[dq]C\[dq]
135 locale,
136 it is equivalent to
137 .IR "(isupper(c)\ ||\ islower(c))" .
138 In some locales, there may be additional characters for which
139 .BR isalpha ()
140 is true\[em]letters which are neither uppercase nor lowercase.
141 .TP
142 .BR isascii ()
143 checks whether
144 .I c
145 is a 7-bit
146 .I unsigned char
147 value that fits into
148 the ASCII character set.
149 .TP
150 .BR isblank ()
151 checks for a blank character;
152 that is, a space or a tab.
153 .TP
154 .BR iscntrl ()
155 checks for a control character.
156 .TP
157 .BR isdigit ()
158 checks for a digit (0 through 9).
159 .TP
160 .BR isgraph ()
161 checks for any printable character except space.
162 .TP
163 .BR islower ()
164 checks for a lowercase character.
165 .TP
166 .BR isprint ()
167 checks for any printable character including space.
168 .TP
169 .BR ispunct ()
170 checks for any printable character which is not a space or an
171 alphanumeric character.
172 .TP
173 .BR isspace ()
174 checks for white-space characters.
175 In the
176 .B \[dq]C\[dq]
177 and
178 .B \[dq]POSIX\[dq]
179 locales, these are: space, form-feed
180 .RB ( \[aq]\[rs]f\[aq] ),
181 newline
182 .RB ( \[aq]\[rs]n\[aq] ),
183 carriage return
184 .RB ( \[aq]\[rs]r\[aq] ),
185 horizontal tab
186 .RB ( \[aq]\[rs]t\[aq] ),
187 and vertical tab
188 .RB ( \[aq]\[rs]v\[aq] ).
189 .TP
190 .BR isupper ()
191 checks for an uppercase letter.
192 .TP
193 .BR isxdigit ()
194 checks for hexadecimal digits, that is, one of
195 .br
196 .BR "0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F" .
197 .SH RETURN VALUE
198 The values returned are nonzero if the character
199 .I c
200 falls into the tested class, and zero if not.
201 .SH ATTRIBUTES
202 For an explanation of the terms used in this section, see
203 .BR attributes (7).
204 .TS
205 allbox;
206 lbx lb lb
207 l l l.
208 Interface Attribute Value
209 T{
210 .na
211 .nh
212 .BR isalnum (),
213 .BR isalpha (),
214 .BR isascii (),
215 .BR isblank (),
216 .BR iscntrl (),
217 .BR isdigit (),
218 .BR isgraph (),
219 .BR islower (),
220 .BR isprint (),
221 .BR ispunct (),
222 .BR isspace (),
223 .BR isupper (),
224 .BR isxdigit ()
225 T} Thread safety MT-Safe
226 .TE
227 .\" FIXME: need a thread-safety statement about the *_l functions
228 .SH STANDARDS
229 .TP
230 .BR isalnum ()
231 .TQ
232 .BR isalpha ()
233 .TQ
234 .BR iscntrl ()
235 .TQ
236 .BR isdigit ()
237 .TQ
238 .BR isgraph ()
239 .TQ
240 .BR islower ()
241 .TQ
242 .BR isprint ()
243 .TQ
244 .BR ispunct ()
245 .TQ
246 .BR isspace ()
247 .TQ
248 .BR isupper ()
249 .TQ
250 .BR isxdigit ()
251 .TQ
252 .BR isblank ()
253 C11, POSIX.1-2008.
254 .TP
255 .BR isascii ()
256 .TQ
257 .BR isalnum_l ()
258 .TQ
259 .BR isalpha_l ()
260 .TQ
261 .BR isblank_l ()
262 .TQ
263 .BR iscntrl_l ()
264 .TQ
265 .BR isdigit_l ()
266 .TQ
267 .BR isgraph_l ()
268 .TQ
269 .BR islower_l ()
270 .TQ
271 .BR isprint_l ()
272 .TQ
273 .BR ispunct_l ()
274 .TQ
275 .BR isspace_l ()
276 .TQ
277 .BR isupper_l ()
278 .TQ
279 .BR isxdigit_l ()
280 POSIX.1-2008.
281 .TP
282 .BR isascii_l ()
283 GNU.
284 .SH HISTORY
285 .TP
286 .BR isalnum ()
287 .TQ
288 .BR isalpha ()
289 .TQ
290 .BR iscntrl ()
291 .TQ
292 .BR isdigit ()
293 .TQ
294 .BR isgraph ()
295 .TQ
296 .BR islower ()
297 .TQ
298 .BR isprint ()
299 .TQ
300 .BR ispunct ()
301 .TQ
302 .BR isspace ()
303 .TQ
304 .BR isupper ()
305 .TQ
306 .BR isxdigit ()
307 C89, POSIX.1-2001.
308 .TP
309 .BR isblank ()
310 C99, POSIX.1-2001.
311 .TP
312 .BR isascii ()
313 POSIX.1-2001 (XSI).
314 .IP
315 POSIX.1-2008 marks it as obsolete,
316 noting that it cannot be used portably in a localized application.
317 .TP
318 .BR isalnum_l ()
319 .TQ
320 .BR isalpha_l ()
321 .TQ
322 .BR isblank_l ()
323 .TQ
324 .BR iscntrl_l ()
325 .TQ
326 .BR isdigit_l ()
327 .TQ
328 .BR isgraph_l ()
329 .TQ
330 .BR islower_l ()
331 .TQ
332 .BR isprint_l ()
333 .TQ
334 .BR ispunct_l ()
335 .TQ
336 .BR isspace_l ()
337 .TQ
338 .BR isupper_l ()
339 .TQ
340 .BR isxdigit_l ()
341 glibc 2.3.
342 POSIX.1-2008.
343 .TP
344 .BR isascii_l ()
345 glibc 2.3.
346 .SH CAVEATS
347 The standards require that the argument
348 .I c
349 for these functions is either
350 .B EOF
351 or a value that is representable in the type
352 .IR "unsigned char" ;
353 otherwise,
354 the behavior is undefined.
355 If the argument
356 .I c
357 is of type
358 .IR char ,
359 it must be cast to
360 .IR "unsigned char" ,
361 as in the following example:
362 .P
363 .in +4n
364 .EX
365 char c;
366 \&...
367 res = toupper((unsigned char) c);
368 .EE
369 .in
370 .P
371 This is necessary because
372 .I char
373 may be the equivalent of
374 .IR "signed char" ,
375 in which case a byte where the top bit is set would be sign extended when
376 converting to
377 .IR int ,
378 yielding a value that is outside the range of
379 .IR "unsigned char" .
380 .P
381 The details of what characters belong to which class depend on the
382 locale.
383 For example,
384 .BR isupper ()
385 will not recognize an A-umlaut (\(:A) as an uppercase letter in the default
386 .B "C"
387 locale.
388 .SH SEE ALSO
389 .BR iswalnum (3),
390 .BR iswalpha (3),
391 .BR iswblank (3),
392 .BR iswcntrl (3),
393 .BR iswdigit (3),
394 .BR iswgraph (3),
395 .BR iswlower (3),
396 .BR iswprint (3),
397 .BR iswpunct (3),
398 .BR iswspace (3),
399 .BR iswupper (3),
400 .BR iswxdigit (3),
401 .BR newlocale (3),
402 .BR setlocale (3),
403 .BR toascii (3),
404 .BR tolower (3),
405 .BR toupper (3),
406 .BR uselocale (3),
407 .BR ascii (7),
408 .BR locale (7)