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