1ISALPHA(3)                 Linux Programmer's 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,
9       isprint_l, ispunct_l,  isspace_l,  isupper_l,  isxdigit_l  -  character
10       classification functions
11

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

135       The  values  returned  are  nonzero  if  the character c falls into the
136       tested class, and zero if not.
137

VERSIONS

139       isalnum_l(),  isalpha_l(),   isblank_l(),   iscntrl_l(),   isdigit_l(),
140       isgraph_l(),  islower_l(), isprint_l(), ispunct_l(), isspace_l(), isup‐
141       per_l(), isxdigit_l(), and isascii_l() are available since glibc 2.3.
142

ATTRIBUTES

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

CONFORMING TO

157       C89  specifies  isalnum(),  isalpha(), iscntrl(), isdigit(), isgraph(),
158       islower(), isprint(), ispunct(), isspace(), isupper(), and  isxdigit(),
159       but  not  isascii()  and  isblank().  POSIX.1-2001 also specifies those
160       functions, and also isascii() (as an XSI extension) and isblank().  C99
161       specifies all of the preceding functions, except isascii().
162
163       POSIX.1-2008 marks isascii() as obsolete, noting that it cannot be used
164       portably in a localized application.
165
166       POSIX.1-2008 specifies  isalnum_l(),  isalpha_l(),  isblank_l(),  iscn‐
167       trl_l(),    isdigit_l(),    isgraph_l(),    islower_l(),   isprint_l(),
168       ispunct_l(), isspace_l(), isupper_l(), and isxdigit_l().
169
170       isascii_l() is a GNU extension.
171

NOTES

173       The standards require that the argument c for these functions is either
174       EOF or a value that is representable in the type unsigned char.  If the
175       argument c is of type char, it must be cast to unsigned char, as in the
176       following example:
177
178           char c;
179           ...
180           res = toupper((unsigned char) c);
181
182       This is necessary because char may be the equivalent of signed char, in
183       which case a byte where the top bit is set would be sign extended  when
184       converting  to  int,  yielding  a  value  that  is outside the range of
185       unsigned char.
186
187       The details of what characters belong to  which  class  depend  on  the
188       locale.   For  example, isupper() will not recognize an A-umlaut (Ä) as
189       an uppercase letter in the default C locale.
190

SEE ALSO

192       iswalnum(3), iswalpha(3), iswblank(3), iswcntrl(3),  iswdigit(3),  isw‐
193       graph(3),  iswlower(3),  iswprint(3),  iswpunct(3), iswspace(3), iswup‐
194       per(3),   iswxdigit(3),   newlocale(3),    setlocale(3),    toascii(3),
195       tolower(3), toupper(3), uselocale(3), ascii(7), locale(7)
196

COLOPHON

198       This  page  is  part of release 5.04 of the Linux man-pages project.  A
199       description of the project, information about reporting bugs,  and  the
200       latest     version     of     this    page,    can    be    found    at
201       https://www.kernel.org/doc/man-pages/.
202
203
204
205GNU                               2017-09-15                        ISALPHA(3)
Impressum