]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/isalpha.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / isalpha.3
CommitLineData
bf5a7247 1.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
fea681da 2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
4.\"
5.\" Modified Sat Jul 24 19:10:00 1993 by Rik Faith (faith@cs.unc.edu)
6.\" Modified Sun Aug 21 17:51:50 1994 by Rik Faith (faith@cs.unc.edu)
7.\" Modified Sat Sep 2 21:52:01 1995 by Jim Van Zandt <jrv@vanzandt.mv.com>
8.\" Modified Mon May 27 22:55:26 1996 by Martin Schulze (joey@linux.de)
9.\"
45186a5d 10.TH ISALPHA 3 2021-03-22 "Linux man-pages (unreleased)"
fea681da 11.SH NAME
c13182ef 12isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph, islower,
72f777e7
MK
13isprint, ispunct, isspace, isupper, isxdigit,
14isalnum_l, isalpha_l, isascii_l, isblank_l, iscntrl_l,
15isdigit_l, isgraph_l, islower_l,
16isprint_l, ispunct_l, isspace_l, isupper_l, isxdigit_l
17\- character classification functions
4508f8a0
AC
18.SH LIBRARY
19Standard C library
8fc3b2cf 20.RI ( libc ", " \-lc )
fea681da
MK
21.SH SYNOPSIS
22.nf
23.B #include <ctype.h>
68e4db0a 24.PP
348ebe84
MK
25.BI "int isalnum(int " c );
26.BI "int isalpha(int " c );
348ebe84
MK
27.BI "int iscntrl(int " c );
28.BI "int isdigit(int " c );
29.BI "int isgraph(int " c );
30.BI "int islower(int " c );
31.BI "int isprint(int " c );
32.BI "int ispunct(int " c );
33.BI "int isspace(int " c );
34.BI "int isupper(int " c );
35.BI "int isxdigit(int " c );
dbfe9c70 36.PP
72f777e7
MK
37.BI "int isascii(int " c );
38.BI "int isblank(int " c );
dbfe9c70 39.PP
72f777e7
MK
40.BI "int isalnum_l(int " c ", locale_t " locale );
41.BI "int isalpha_l(int " c ", locale_t " locale );
42.BI "int isblank_l(int " c ", locale_t " locale );
43.BI "int iscntrl_l(int " c ", locale_t " locale );
44.BI "int isdigit_l(int " c ", locale_t " locale );
45.BI "int isgraph_l(int " c ", locale_t " locale );
46.BI "int islower_l(int " c ", locale_t " locale );
47.BI "int isprint_l(int " c ", locale_t " locale );
48.BI "int ispunct_l(int " c ", locale_t " locale );
49.BI "int isspace_l(int " c ", locale_t " locale );
50.BI "int isupper_l(int " c ", locale_t " locale );
51.BI "int isxdigit_l(int " c ", locale_t " locale );
dbfe9c70 52.PP
72f777e7 53.BI "int isascii_l(int " c ", locale_t " locale );
fea681da 54.fi
68e4db0a 55.PP
d39ad78f 56.RS -4
cc4615cc
MK
57Feature Test Macro Requirements for glibc (see
58.BR feature_test_macros (7)):
d39ad78f 59.RE
cc4615cc 60.ad l
9d2adbae 61.PP
cc4615cc 62.BR isascii ():
9d2adbae
MK
63.nf
64 _XOPEN_SOURCE
65 || /* Glibc since 2.19: */ _DEFAULT_SOURCE
66 || /* Glibc <= 2.19: */ _SVID_SOURCE
67.fi
847e0d88 68.PP
cc4615cc 69.BR isblank ():
9d2adbae 70.nf
5c10d2c5 71 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
9d2adbae 72.fi
9834f61d 73.nh
847e0d88 74.PP
72f777e7
MK
75.BR isalnum_l (),
76.BR isalpha_l (),
77.BR isblank_l (),
78.BR iscntrl_l (),
79.BR isdigit_l (),
80.BR isgraph_l (),
81.BR islower_l (),
82.BR isprint_l (),
83.BR ispunct_l (),
84.BR isspace_l (),
85.BR isupper_l (),
86.BR isxdigit_l ():
9834f61d 87.hy
9d2adbae
MK
88.nf
89 Since glibc 2.10:
5c10d2c5 90 _XOPEN_SOURCE >= 700
9d2adbae
MK
91 Before glibc 2.10:
92 _GNU_SOURCE
93.fi
847e0d88 94.PP
5ee5df69 95.BR isascii_l ():
9d2adbae
MK
96.nf
97 Since glibc 2.10:
5c10d2c5 98 _XOPEN_SOURCE >= 700 && (_SVID_SOURCE || _BSD_SOURCE)
9d2adbae
MK
99 Before glibc 2.10:
100 _GNU_SOURCE
101.fi
73f6b681 102.ad
fea681da
MK
103.SH DESCRIPTION
104These functions check whether
105.IR c ,
106which must have the value of an
9ff08aad 107.I unsigned char
fea681da
MK
108or
109.BR EOF ,
72f777e7
MK
110falls into a certain character class according to the specified locale.
111The functions without the
112"_l" suffix perform the check based on the current locale.
847e0d88 113.PP
72f777e7
MK
114The functions with the "_l" suffix perform the check
115based on the locale specified by the locale object
116.IR locale .
117The behavior of these functions is undefined if
118.I locale
119is the special locale object
120.B LC_GLOBAL_LOCALE
121(see
122.BR duplocale (3))
123or is not a valid locale object handle.
847e0d88 124.PP
72f777e7
MK
125The list below explains the operation of the functions without
126the "_l" suffix;
127the functions with the "_l" suffix differ only in using the locale object
128.I locale
129instead of the current locale.
c13182ef 130.TP
e1d6264d 131.BR isalnum ()
fea681da
MK
132checks for an alphanumeric character; it is equivalent to
133.BI "(isalpha(" c ") || isdigit(" c "))" \fR.
134.TP
e1d6264d 135.BR isalpha ()
c13182ef 136checks for an alphabetic character; in the standard \fB"C"\fP
fea681da
MK
137locale, it is equivalent to
138.BI "(isupper(" c ") || islower(" c "))" \fR.
139In some locales, there may be additional characters for which
f87925c6 140.BR isalpha ()
efaef3da 141is true\(emletters which are neither uppercase nor lowercase.
fea681da 142.TP
e1d6264d 143.BR isascii ()
fea681da
MK
144checks whether \fIc\fP is a 7-bit
145.I unsigned char
146value that fits into
68e1685c 147the ASCII character set.
fea681da 148.TP
e1d6264d 149.BR isblank ()
fea681da
MK
150checks for a blank character; that is, a space or a tab.
151.TP
e1d6264d 152.BR iscntrl ()
fea681da
MK
153checks for a control character.
154.TP
e1d6264d 155.BR isdigit ()
fea681da
MK
156checks for a digit (0 through 9).
157.TP
e1d6264d 158.BR isgraph ()
fea681da
MK
159checks for any printable character except space.
160.TP
e1d6264d 161.BR islower ()
efaef3da 162checks for a lowercase character.
fea681da 163.TP
e1d6264d 164.BR isprint ()
fea681da
MK
165checks for any printable character including space.
166.TP
e1d6264d 167.BR ispunct ()
fea681da
MK
168checks for any printable character which is not a space or an
169alphanumeric character.
170.TP
e1d6264d 171.BR isspace ()
c13182ef
MK
172checks for white-space characters.
173In the
fea681da
MK
174.B """C"""
175and
176.B """POSIX"""
177locales, these are: space, form-feed
31a6818e 178.RB ( \(aq\ef\(aq ),
fea681da 179newline
31a6818e 180.RB ( \(aq\en\(aq ),
fea681da 181carriage return
31a6818e 182.RB ( \(aq\er\(aq ),
fea681da 183horizontal tab
31a6818e 184.RB ( \(aq\et\(aq ),
fea681da 185and vertical tab
31a6818e 186.RB ( \(aq\ev\(aq ).
fea681da 187.TP
e1d6264d 188.BR isupper ()
fea681da
MK
189checks for an uppercase letter.
190.TP
e1d6264d 191.BR isxdigit ()
72f777e7 192checks for hexadecimal digits, that is, one of
defcceb3 193.br
fea681da 194.BR "0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F" .
47297adb 195.SH RETURN VALUE
c7094399 196The values returned are nonzero if the character
fea681da 197.I c
72f777e7 198falls into the tested class, and zero if not.
ec0f3c46
MK
199.SH VERSIONS
200.BR isalnum_l (),
201.BR isalpha_l (),
202.BR isblank_l (),
203.BR iscntrl_l (),
204.BR isdigit_l (),
205.BR isgraph_l (),
206.BR islower_l (),
207.BR isprint_l (),
208.BR ispunct_l (),
209.BR isspace_l (),
210.BR isupper_l (),
211.BR isxdigit_l (),
212and
213.BR isascii_l ()
214are available since glibc 2.3.
f2eb5b9c 215.SH ATTRIBUTES
d270f4d2
MK
216For an explanation of the terms used in this section, see
217.BR attributes (7).
218.ad l
c466875e 219.nh
d270f4d2
MK
220.TS
221allbox;
c466875e 222lbx lb lb
d270f4d2
MK
223l l l.
224Interface Attribute Value
225T{
f2eb5b9c
PH
226.BR isalnum (),
227.BR isalpha (),
228.BR isascii (),
229.BR isblank (),
230.BR iscntrl (),
231.BR isdigit (),
232.BR isgraph (),
233.BR islower (),
234.BR isprint (),
235.BR ispunct (),
236.BR isspace (),
237.BR isupper (),
f2eb5b9c 238.BR isxdigit ()
d270f4d2
MK
239T} Thread safety MT-Safe
240.TE
c466875e 241.hy
d270f4d2 242.ad
c466875e 243.sp 1
d270f4d2 244.\" FIXME: need a thread-safety statement about the *_l functions
3113c7f3 245.SH STANDARDS
72f777e7
MK
246C89 specifies
247.BR isalnum (),
248.BR isalpha (),
249.BR iscntrl (),
250.BR isdigit (),
251.BR isgraph (),
252.BR islower (),
253.BR isprint (),
254.BR ispunct (),
255.BR isspace (),
256.BR isupper (),
257and
258.BR isxdigit (),
259but not
60a90ecd
MK
260.BR isascii ()
261and
262.BR isblank ().
72f777e7 263POSIX.1-2001
89851a00 264also specifies those functions, and also
60a90ecd 265.BR isascii ()
72f777e7
MK
266(as an XSI extension)
267and
268.BR isblank ().
269C99 specifies all of the preceding functions, except
270.BR isascii ().
847e0d88 271.PP
712ad842 272POSIX.1-2008 marks
2472260f 273.BR isascii ()
ff9fe6df
MK
274as obsolete,
275noting that it cannot be used portably in a localized application.
847e0d88 276.PP
a03c016c 277POSIX.1-2008 specifies
72f777e7
MK
278.BR isalnum_l (),
279.BR isalpha_l (),
280.BR isblank_l (),
281.BR iscntrl_l (),
282.BR isdigit_l (),
283.BR isgraph_l (),
284.BR islower_l (),
285.BR isprint_l (),
286.BR ispunct_l (),
287.BR isspace_l (),
288.BR isupper_l (),
289and
290.BR isxdigit_l ().
847e0d88 291.PP
72f777e7
MK
292.BR isascii_l ()
293is a GNU extension.
19c98696 294.SH NOTES
3c5ba5ed
MK
295The standards require that the argument
296.I c
297for these functions is either
298.B EOF
299or a value that is representable in the type
300.IR "unsigned char" .
301If the argument
302.I c
303is of type
304.IR char ,
305it must be cast to
306.IR "unsigned char" ,
307as in the following example:
847e0d88 308.PP
3c5ba5ed 309.in +4n
b8302363 310.EX
3c5ba5ed
MK
311char c;
312\&...
313res = toupper((unsigned char) c);
b8302363 314.EE
e646a1ba 315.in
847e0d88 316.PP
3c5ba5ed
MK
317This is necessary because
318.I char
02326b5c 319may be the equivalent of
3c5ba5ed
MK
320.IR "signed char" ,
321in which case a byte where the top bit is set would be sign extended when
322converting to
323.IR int ,
324yielding a value that is outside the range of
325.IR "unsigned char" .
847e0d88 326.PP
72f777e7 327The details of what characters belong to which class depend on the
c13182ef
MK
328locale.
329For example,
63aa9df0 330.BR isupper ()
c65433e6 331will not recognize an A-umlaut (\(:A) as an uppercase letter in the default
fea681da
MK
332.B "C"
333locale.
47297adb 334.SH SEE ALSO
1709027c
MK
335.BR iswalnum (3),
336.BR iswalpha (3),
337.BR iswblank (3),
338.BR iswcntrl (3),
339.BR iswdigit (3),
340.BR iswgraph (3),
341.BR iswlower (3),
342.BR iswprint (3),
343.BR iswpunct (3),
344.BR iswspace (3),
345.BR iswupper (3),
346.BR iswxdigit (3),
72f777e7 347.BR newlocale (3),
fea681da 348.BR setlocale (3),
980ee95f 349.BR toascii (3),
fea681da
MK
350.BR tolower (3),
351.BR toupper (3),
dd18a3b6 352.BR uselocale (3),
fea681da
MK
353.BR ascii (7),
354.BR locale (7)