OSDN Git Service

02e8eafb838f38dc1e981e9dfcfd4e002632dfe6
[linuxjm/LDP_man-pages.git] / original / man3 / isalpha.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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.
12 .\"
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.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
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 .\"
30 .TH ISALPHA 3 2014-03-18 "GNU" "Linux Programmer's Manual"
31 .SH NAME
32 isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph, islower,
33 isprint, ispunct, isspace, isupper, isxdigit,
34 isalnum_l, isalpha_l, isascii_l, isblank_l, iscntrl_l,
35 isdigit_l, isgraph_l, islower_l,
36 isprint_l, ispunct_l, isspace_l, isupper_l, isxdigit_l
37 \- character classification functions
38 .SH SYNOPSIS
39 .nf
40 .B #include <ctype.h>
41 .sp
42 .BI "int isalnum(int " c );
43 .BI "int isalpha(int " c );
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 );
53
54 .BI "int isascii(int " c );
55 .BI "int isblank(int " c );
56
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 );
69
70 .BI "int isascii_l(int " c ", locale_t " locale );
71 .fi
72 .sp
73 .in -4n
74 Feature Test Macro Requirements for glibc (see
75 .BR feature_test_macros (7)):
76 .in
77 .sp
78 .ad l
79 .BR isascii ():
80 .RS 4
81 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE
82 .br
83 .RE
84
85 .BR isblank ():
86 .RS 4
87 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
88 _POSIX_C_SOURCE\ >=\ 200112L;
89 .br
90 or
91 .I cc\ -std=c99
92 .RE
93
94 .BR isalnum_l (),
95 .BR isalpha_l (),
96 .BR isblank_l (),
97 .BR iscntrl_l (),
98 .BR isdigit_l (),
99 .BR isgraph_l (),
100 .BR islower_l (),
101 .BR isprint_l (),
102 .BR ispunct_l (),
103 .BR isspace_l (),
104 .BR isupper_l (),
105 .BR isxdigit_l ():
106 .PD 0
107 .RS 4
108 .TP
109 Since glibc 2.10:
110 _XOPEN_SOURCE\ >=\ 700
111 .TP
112 Before glibc 2.10:
113 _GNU_SOURCE
114 .RE
115 .PD
116
117 .BR isascii_l ():
118 .PD 0
119 .RS 4
120 .TP
121 Since glibc 2.10:
122 _XOPEN_SOURCE\ >=\ 700 && (_SVID_SOURCE || _BSD_SOURCE)
123 .TP
124 Before glibc 2.10:
125 _GNU_SOURCE
126 .RE
127 .PD
128 .ad
129 .SH DESCRIPTION
130 These functions check whether
131 .IR c ,
132 which must have the value of an
133 .I unsigned char
134 or
135 .BR EOF ,
136 falls into a certain character class according to the specified locale.
137 The functions without the
138 "_l" suffix perform the check based on the current locale.
139
140 The functions with the "_l" suffix perform the check
141 based on the locale specified by the locale object
142 .IR locale .
143 The behavior of these functions is undefined if
144 .I locale
145 is the special locale object
146 .B LC_GLOBAL_LOCALE
147 (see
148 .BR duplocale (3))
149 or is not a valid locale object handle.
150
151 The list below explains the operation of the functions without
152 the "_l" suffix;
153 the functions with the "_l" suffix differ only in using the locale object
154 .I locale
155 instead of the current locale.
156 .TP
157 .BR isalnum ()
158 checks for an alphanumeric character; it is equivalent to
159 .BI "(isalpha(" c ") || isdigit(" c "))" \fR.
160 .TP
161 .BR isalpha ()
162 checks for an alphabetic character; in the standard \fB"C"\fP
163 locale, it is equivalent to
164 .BI "(isupper(" c ") || islower(" c "))" \fR.
165 In some locales, there may be additional characters for which
166 .BR isalpha ()
167 is true\(emletters which are neither uppercase nor lowercase.
168 .TP
169 .BR isascii ()
170 checks whether \fIc\fP is a 7-bit
171 .I unsigned char
172 value that fits into
173 the ASCII character set.
174 .TP
175 .BR isblank ()
176 checks for a blank character; that is, a space or a tab.
177 .TP
178 .BR iscntrl ()
179 checks for a control character.
180 .TP
181 .BR isdigit ()
182 checks for a digit (0 through 9).
183 .TP
184 .BR isgraph ()
185 checks for any printable character except space.
186 .TP
187 .BR islower ()
188 checks for a lowercase character.
189 .TP
190 .BR isprint ()
191 checks for any printable character including space.
192 .TP
193 .BR ispunct ()
194 checks for any printable character which is not a space or an
195 alphanumeric character.
196 .TP
197 .BR isspace ()
198 checks for white-space characters.
199 In the
200 .B """C"""
201 and
202 .B """POSIX"""
203 locales, these are: space, form-feed
204 .RB ( \(aq\ef\(aq ),
205 newline
206 .RB ( \(aq\en\(aq ),
207 carriage return
208 .RB ( \(aq\er\(aq ),
209 horizontal tab
210 .RB ( \(aq\et\(aq ),
211 and vertical tab
212 .RB ( \(aq\ev\(aq ).
213 .TP
214 .BR isupper ()
215 checks for an uppercase letter.
216 .TP
217 .BR isxdigit ()
218 checks for hexadecimal digits, that is, one of
219 .br
220 .BR "0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F" .
221 .SH RETURN VALUE
222 The values returned are nonzero if the character
223 .I c
224 falls into the tested class, and zero if not.
225 .SH ATTRIBUTES
226 .SS Multithreading (see pthreads(7))
227 The
228 .BR isalnum (),
229 .BR isalpha (),
230 .BR isascii (),
231 .BR isblank (),
232 .BR iscntrl (),
233 .BR isdigit (),
234 .BR isgraph (),
235 .BR islower (),
236 .BR isprint (),
237 .BR ispunct (),
238 .BR isspace (),
239 .BR isupper (),
240 and
241 .BR isxdigit ()
242 functions are thread-safe.
243 .\" FIXME: need a thread-safety statement about the *_l functions
244 .SH VERSIONS
245 .BR isalnum_l (),
246 .BR isalpha_l (),
247 .BR isblank_l (),
248 .BR iscntrl_l (),
249 .BR isdigit_l (),
250 .BR isgraph_l (),
251 .BR islower_l (),
252 .BR isprint_l (),
253 .BR ispunct_l (),
254 .BR isspace_l (),
255 .BR isupper_l (),
256 .BR isxdigit_l (),
257 and
258 .BR isascii_l ()
259 are available since glibc 2.3.
260 .SH CONFORMING TO
261 C89 specifies
262 .BR isalnum (),
263 .BR isalpha (),
264 .BR iscntrl (),
265 .BR isdigit (),
266 .BR isgraph (),
267 .BR islower (),
268 .BR isprint (),
269 .BR ispunct (),
270 .BR isspace (),
271 .BR isupper (),
272 and
273 .BR isxdigit (),
274 but not
275 .BR isascii ()
276 and
277 .BR isblank ().
278 POSIX.1-2001
279 also specifies those functions, and also
280 .BR isascii ()
281 (as an XSI extension)
282 and
283 .BR isblank ().
284 C99 specifies all of the preceding functions, except
285 .BR isascii ().
286
287 POSIX.1-2008 marks
288 .BR isascii ()
289 as obsolete,
290 noting that it cannot be used portably in a localized application.
291
292 POSIX.1-2008 specifies
293 .BR isalnum_l (),
294 .BR isalpha_l (),
295 .BR isblank_l (),
296 .BR iscntrl_l (),
297 .BR isdigit_l (),
298 .BR isgraph_l (),
299 .BR islower_l (),
300 .BR isprint_l (),
301 .BR ispunct_l (),
302 .BR isspace_l (),
303 .BR isupper_l (),
304 and
305 .BR isxdigit_l ().
306
307 .BR isascii_l ()
308 is a GNU extension.
309 .SH NOTES
310 The details of what characters belong to which class depend on the
311 locale.
312 For example,
313 .BR isupper ()
314 will not recognize an A-umlaut (\(:A) as an uppercase letter in the default
315 .B "C"
316 locale.
317 .SH SEE ALSO
318 .BR iswalnum (3),
319 .BR iswalpha (3),
320 .BR iswblank (3),
321 .BR iswcntrl (3),
322 .BR iswdigit (3),
323 .BR iswgraph (3),
324 .BR iswlower (3),
325 .BR iswprint (3),
326 .BR iswpunct (3),
327 .BR iswspace (3),
328 .BR iswupper (3),
329 .BR iswxdigit (3),
330 .BR newlocale (3),
331 .BR setlocale (3),
332 .BR uselocale (3),
333 .BR toascii (3),
334 .BR tolower (3),
335 .BR toupper (3),
336 .BR ascii (7),
337 .BR locale (7)
338 .SH COLOPHON
339 This page is part of release 3.67 of the Linux
340 .I man-pages
341 project.
342 A description of the project,
343 information about reporting bugs,
344 and the latest version of this page,
345 can be found at
346 \%http://www.kernel.org/doc/man\-pages/.