1ctype(3C)                Standard C Library Functions                ctype(3C)
2
3
4

NAME

6       ctype,  isalpha,  isalnum, isascii, isblank, iscntrl, isdigit, islower,
7       isprint, isspace, isupper, ispunct, isgraph, isxdigit - character  han‐
8       dling
9

SYNOPSIS

11       #include <ctype.h>
12
13       int isalpha(int c);
14
15
16       int isalnum(int c);
17
18
19       int isascii(int c);
20
21
22       int isblank(int c);
23
24
25       int iscntrl(int c);
26
27
28       int isdigit(int c);
29
30
31       int isgraph(int c);
32
33
34       int islower(int c);
35
36
37       int isprint(int c);
38
39
40       int ispunct(int c);
41
42
43       int isspace(int c);
44
45
46       int isupper(int c);
47
48
49       int isxdigit(int c);
50
51

DESCRIPTION

53       These  macros classify character-coded integer values. Each is a predi‐
54       cate returning non-zero for true, 0 for false. The  behavior  of  these
55       macros, except isascii(), is affected by the current locale (see setlo‐
56       cale(3C)). To modify the behavior, change the LC_TYPE category in  set‐
57       locale(),  that  is, setlocale(LC_CTYPE, newlocale). In the "C" locale,
58       or in a locale where character type information is not defined, charac‐
59       ters  are classified according to the rules of the US-ASCII 7-bit coded
60       character set.
61
62
63       The isascii() macro is defined on all  integer  values.  The  rest  are
64       defined only where the argument is an int, the value of which is repre‐
65       sentable as an unsigned char, or EOF, which is defined by the <stdio.h>
66       header and represents end-of-file.
67
68
69       Functions  exist  for all the macros defined below. To get the function
70       form, the macro name must be undefined (for example, #undef isdigit).
71
72
73       For macros described with Default  and  Standard  conforming  versions,
74       standard-conforming behavior is provided for standard-conforming appli‐
75       cations  (see  standards(5))   and   for   applications   that   define
76       __XPG4_CHAR_CLASS__ before including <ctype.h>.
77
78   Default
79       isalpha()    Tests  for  any character for which isupper() or islower()
80                    is true.
81
82
83   Standard conforming
84       isalpha()    Tests for any character for which isupper()  or  islower()
85                    is  true,  or  any  character  that  is one of the current
86                    locale-defined set of characters for which none  of  iscn‐
87                    trl(),  isdigit(), ispunct(), or isspace() is true. In "C"
88                    locale, isalpha() returns true only for the characters for
89                    which isupper() or islower() is true.
90
91
92       isalnum()    Tests  for  any character for which isalpha() or isdigit()
93                    is true (letter or digit).
94
95
96       isascii()    Tests for any ASCII character, code  between  0  and  0177
97                    inclusive.
98
99
100       isblank()    Tests  whether c is a character of class blank in the cur‐
101                    rent locale.  This  macro/function  is  not  available  to
102                    applications  conforming  to standards prior to SUSv3. See
103                    standards(5)
104
105
106       iscntrl()    Tests for any ``control  character''  as  defined  by  the
107                    character set.
108
109
110       isdigit()    Tests for any decimal-digit character.
111
112
113   Default
114       isgraph()    Tests  for  any  character for which ispunct(), isupper(),
115                    islower(), and isdigit() is true.
116
117
118   Standard conforming
119       isgraph()    Tests for any character for which isalnum() and  ispunct()
120                    are  true,  or any character in the current locale-defined
121                    "graph" class which is neither a space ("") nor a  charac‐
122                    ter for which iscntrl() is true.
123
124
125       islower()    Tests  for any character that is a lower-case letter or is
126                    one of the current locale-defined set  of  characters  for
127                    which  none of iscntrl(), isdigit(), ispunct(), isspace(),
128                    or isupper() is true. In the "C" locale, islower() returns
129                    true  only  for the characters defined as lower-case ASCII
130                    characters.
131
132
133   Default
134       isprint()    Tests for any character for  which  ispunct(),  isupper(),
135                    islower(),  isdigit(),  and  the  space  character ("") is
136                    true.
137
138
139   Standard conforming
140       isprint()    Tests for any character for which iscntrl() is false,  and
141                    isalnum(), isgraph(), ispunct(), the space character (""),
142                    and the characters in the current  locale-defined  "print"
143                    class are true.
144
145
146       ispunct()    Tests  for any printing character which is neither a space
147                    ("") nor a character for which isalnum() or  iscntrl()  is
148                    true.
149
150
151       isspace()    Tests for any space, tab, carriage-return, newline, verti‐
152                    cal-tab or form-feed (standard white-space characters)  or
153                    for  one  of  the current locale-defined set of characters
154                    for which isalnum() is false.  In  the  "C"  locale,  iss‐
155                    pace()  returns  true  only  for  the standard white-space
156                    characters.
157
158
159       isupper()    Tests for any character that is an upper-case letter or is
160                    one  of  the  current locale-defined set of characters for
161                    which none of iscntrl(), isdigit(), ispunct(),  isspace(),
162                    or islower() is true. In the "C" locale, isupper() returns
163                    true only for the characters defined as  upper-case  ASCII
164                    characters.
165
166
167   Default
168       isxdigit()    Tests  for any hexadecimal-digit character ([0−9], [A−F],
169                     or [a−f]).
170
171
172   Standard conforming
173       isxdigit()    Tests for any hexadecimal-digit character ([0−9],  [A−F],
174                     or [a−f] or the current locale-defined sets of characters
175                     representing the hexadecimal digits 10 to 15  inclusive).
176                     In the "C" locale, only
177
178                       0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
179
180                     are included.
181
182

RETURN VALUES

184       If  the  argument to any of the character handling macros is not in the
185       domain of the function, the result is undefined. Otherwise,  the  macro
186       or function returns non-zero if the classification is TRUE and 0 if the
187       classification is FALSE.
188

USAGE

190       These macros or functions can be used safely in multithreaded  applica‐
191       tions,  as  long  as  setlocale(3C)  is  not being called to change the
192       locale.
193

ATTRIBUTES

195       See attributes(5) for descriptions of the following attributes:
196
197
198
199
200       ┌───────────────────────────────────────────────────────────┐
201       │ATTRIBUTE TYPE                ATTRIBUTE VALUE              │
202       │CSI                           Enabled                      │
203       │Interface Stability           Standard                     │
204       │MT-Level                      MT-Safe with exceptions      │
205       └───────────────────────────────────────────────────────────┘
206

SEE ALSO

208       setlocale(3C), stdio(3C), ascii(5), environ(5), standards(5)
209
210
211
212SunOS 5.11                        28 Jan 2005                        ctype(3C)
Impressum