Print this page
11586 NAME field in man pages should match what's installed


  29 .\" You may not use this file except in compliance with the License.
  30 .\"
  31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  32 .\" or http://www.opensolaris.org/os/licensing.
  33 .\" See the License for the specific language governing permissions
  34 .\" and limitations under the License.
  35 .\"
  36 .\" When distributing Covered Code, include this CDDL HEADER in each
  37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38 .\" If applicable, add the following below this CDDL HEADER, with the
  39 .\" fields enclosed by brackets "[]" replaced with your own identifying
  40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41 .\"
  42 .\"
  43 .\" Copyright 1989 AT&T.
  44 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
  45 .\" Portions Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved.
  46 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
  47 .\" Copyright 2016 Joyent, Inc.
  48 .\"
  49 .TH CTYPE 3C "Mar 14, 2016"
  50 .SH NAME
  51 ctype, isalpha, isalnum, isascii, isblank, iscntrl, isdigit, islower,
  52 isprint, isspace, isupper, ispunct, isgraph, isxdigit, isalpha_l,
  53 isalnum_l, isblank_l, iscntrl_l, isdigit_l, islower_l, isprint_l,
  54 isspace_l, isupper_l, ispunct_l, isgraph_l isxdigit_l \- character handling
  55 .SH SYNOPSIS
  56 .LP
  57 .nf
  58 #include <ctype.h>
  59 
  60 \fBint\fR \fBisalpha\fR(\fBint\fR \fIc\fR);
  61 .fi
  62 .LP
  63 .nf
  64 \fBint\fR \fBisalnum\fR(\fBint\fR \fIc\fR);
  65 .fi
  66 .LP
  67 .nf
  68 \fBint\fR \fBisascii\fR(\fBint\fR \fIc\fR);
  69 .fi
  70 .LP
  71 .nf
  72 \fBint\fR \fBisblank\fR(\fBint\fR \fIc\fR);
  73 .fi
  74 .LP
  75 .nf
  76 \fBint\fR \fBiscntrl\fR(\fBint\fR \fIc\fR);


 139 .nf
 140 \fBint\fR \fBisprint_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 141 .fi
 142 .LP
 143 .nf
 144 \fBint\fR \fBispunct_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 145 .fi
 146 .LP
 147 .nf
 148 \fBint\fR \fBisspace_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 149 .fi
 150 .LP
 151 .nf
 152 \fBint\fR \fBisupper_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 153 .fi
 154 .LP
 155 .nf
 156 \fBint\fR \fBisxdigit_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 157 .fi
 158 .SH DESCRIPTION
 159 .LP
 160 These functions classify character-coded integer values. Each is a
 161 predicate returning non-zero for true, \fB0\fR for false. The behavior
 162 of these macros, except \fBisascii()\fR, is affected by the current
 163 locale (see \fBsetlocale\fR(3C) and \fBuselocale\fR(3C)). To modify
 164 the behavior, change the \fBLC_TYPE\fR category in \fBsetlocale()\fR, that is,
 165 \fBsetlocale(\fR\fBLC_CTYPE\fR, \fInewlocale\fR). In the "C" locale,
 166 or in a locale where character type information is not defined,
 167 characters are classified according to the rules of the \fBUS-ASCII\fR
 168 7-bit coded character set.
 169 .LP
 170 The functions \fBisalnum_l()\fR, \fBisalpha_l()\fR, \fBisblank_l()\fR,
 171 \fBiscntrl_l\fR, \fBisdigit_l()\fR, \fBisgraph_l()\fR,
 172 \fBislower_l()\fR, \fBisprint_l()\fR, \fBispunct_l()\fR,
 173 \fBisspace_l()\fR, \fBisupper_l()\fR, and \fBisxdigit_l()\fR all behave
 174 identically to their counterparts without the '\fB_l\fR' prefix, except
 175 that instead of acting on the current locale, they perform the test on
 176 the locale specified in the argument \fIloc\fR.
 177 .LP
 178 The \fBisascii()\fR macro is defined on all integer values. The rest are
 179 defined only where the argument is an \fBint\fR, the value of which is
 180 representable as an \fBunsigned char\fR, or \fBEOF\fR, which is defined by the
 181 <\fBstdio.h\fR> header and represents end-of-file.
 182 .sp
 183 .ne 2
 184 .na
 185 \fB\fBisalpha()\fR\fR
 186 .ad
 187 .RS 13n
 188 Tests for any character for which \fBisupper()\fR or \fBislower()\fR is true,
 189 or any character that is one of the current locale-defined set of characters
 190 for which none of \fBiscntrl()\fR, \fBisdigit()\fR, \fBispunct()\fR, or
 191 \fBisspace()\fR is true. In "C" locale, \fBisalpha()\fR returns true only for
 192 the characters for which \fBisupper()\fR or \fBislower()\fR is true.
 193 .RE
 194 
 195 .sp
 196 .ne 2
 197 .na
 198 \fB\fBisalnum()\fR\fR
 199 .ad
 200 .RS 13n
 201 Tests for any character for which \fBisalpha()\fR or \fBisdigit()\fR is true
 202 (letter or digit).
 203 .RE
 204 
 205 .sp
 206 .ne 2
 207 .na
 208 \fB\fBisascii()\fR\fR
 209 .ad
 210 .RS 13n
 211 Tests for any ASCII character, code between \fB0\fR and \fB0177\fR inclusive.
 212 .RE
 213 
 214 .sp
 215 .ne 2
 216 .na
 217 \fB\fBisblank()\fR\fR
 218 .ad
 219 .RS 13n
 220 Tests whether \fIc\fR is a character of class blank in the current locale. This
 221 macro/function is not available to applications conforming to standards prior
 222 to SUSv3. See \fBstandards\fR(5)
 223 .RE
 224 
 225 .sp
 226 .ne 2
 227 .na
 228 \fB\fBiscntrl()\fR\fR
 229 .ad
 230 .RS 13n
 231 Tests for any ``control character'' as defined by the character set.
 232 .RE
 233 
 234 .sp
 235 .ne 2
 236 .na
 237 \fB\fBisdigit()\fR\fR
 238 .ad
 239 .RS 13n
 240 Tests for any decimal-digit character.
 241 .RE
 242 
 243 .sp
 244 .ne 2
 245 .na
 246 \fB\fBisgraph()\fR\fR
 247 .ad
 248 .RS 13n
 249 Tests for any character for which \fBisalnum()\fR and \fBispunct()\fR are true,
 250 or any character in the current locale-defined "graph" class which is neither a
 251 space ("\|") nor a character for which \fBiscntrl()\fR is true.
 252 .RE
 253 
 254 .sp
 255 .ne 2
 256 .na
 257 \fB\fBislower()\fR\fR
 258 .ad
 259 .RS 13n
 260 Tests for any character that is a lower-case letter or is one of the current
 261 locale-defined set of characters for which none of \fBiscntrl()\fR,
 262 \fBisdigit()\fR, \fBispunct()\fR, \fBisspace()\fR, or \fBisupper()\fR is true.
 263 In the "C" locale, \fBislower()\fR returns true only for the characters defined
 264 as lower-case \fBASCII\fR characters.
 265 .RE
 266 
 267 .sp
 268 .ne 2
 269 .na
 270 \fB\fBisprint()\fR\fR
 271 .ad
 272 .RS 13n
 273 Tests for any character for which \fBiscntrl()\fR is false, and
 274 \fBisalnum()\fR, \fBisgraph()\fR, \fBispunct()\fR, the space character ("\|"),
 275 and the characters in the current locale-defined "print" class are true.
 276 .RE
 277 
 278 .sp
 279 .ne 2
 280 .na
 281 \fB\fBispunct()\fR\fR
 282 .ad
 283 .RS 13n
 284 Tests for any printing character which is neither a space ("\|") nor a
 285 character for which \fBisalnum()\fR or \fBiscntrl()\fR is true.
 286 .RE
 287 
 288 .sp
 289 .ne 2
 290 .na
 291 \fB\fBisspace()\fR\fR
 292 .ad
 293 .RS 13n
 294 Tests for any space, tab, carriage-return, newline, vertical-tab or form-feed
 295 (standard white-space characters) or for one of the current locale-defined set
 296 of characters for which \fBisalnum()\fR is false.  In the "C" locale,
 297 \fBisspace()\fR returns true only for the standard white-space characters.
 298 .RE
 299 
 300 .sp
 301 .ne 2
 302 .na
 303 \fB\fBisupper()\fR\fR
 304 .ad
 305 .RS 13n
 306 Tests for any character that is an upper-case letter or is one of the current
 307 locale-defined set of characters for which none of \fBiscntrl()\fR,
 308 \fBisdigit()\fR, \fBispunct()\fR, \fBisspace()\fR, or \fBislower()\fR is true.
 309 In the "C" locale, \fBisupper()\fR returns true only for the characters defined
 310 as upper-case \fBASCII\fR characters.
 311 .RE
 312 
 313 .sp
 314 .ne 2
 315 .na
 316 \fB\fBisxdigit()\fR\fR
 317 .ad
 318 .RS 14n
 319 Tests for any hexadecimal-digit character (\fB[0\(mi9]\fR, \fB[A\(miF]\fR, or
 320 \fB[a\(mif]\fR or the current locale-defined sets of characters representing
 321 the hexadecimal digits \fB10\fR to \fB15\fR inclusive). In the "C" locale, only
 322 .sp
 323 .in +2
 324 .nf
 325 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
 326 .fi
 327 .in -2
 328 
 329 are included.
 330 .RE
 331 
 332 .SH RETURN VALUES
 333 .LP
 334 If the argument to any of the character handling macros is not in the domain of
 335 the function, the result is undefined. Otherwise, the macro or function returns
 336 non-zero if the classification is \fBTRUE\fR and \fB0\fR if the classification
 337 is \fBFALSE\fR.
 338 .SH ATTRIBUTES
 339 .LP
 340 See \fBattributes\fR(5) for descriptions of the following attributes:
 341 .TS
 342 box;
 343 c | c
 344 l | l .
 345 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 346 _
 347 CSI     Enabled
 348 _
 349 Interface Stability     Standard
 350 _
 351 MT-Level        MT-Safe
 352 .TE
 353 
 354 .SH SEE ALSO
 355 .LP
 356 \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C),
 357 \fBstdio\fR(3C), \fBascii\fR(5), \fBenviron\fR(5),
 358 \fBstandards\fR(5)


  29 .\" You may not use this file except in compliance with the License.
  30 .\"
  31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  32 .\" or http://www.opensolaris.org/os/licensing.
  33 .\" See the License for the specific language governing permissions
  34 .\" and limitations under the License.
  35 .\"
  36 .\" When distributing Covered Code, include this CDDL HEADER in each
  37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38 .\" If applicable, add the following below this CDDL HEADER, with the
  39 .\" fields enclosed by brackets "[]" replaced with your own identifying
  40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41 .\"
  42 .\"
  43 .\" Copyright 1989 AT&T.
  44 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
  45 .\" Portions Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved.
  46 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
  47 .\" Copyright 2016 Joyent, Inc.
  48 .\"
  49 .TH CTYPE 3C "Aug 20, 2019"
  50 .SH NAME
  51 ctype, isalpha, isalnum, isascii, isblank, iscntrl, isdigit, islower,
  52 isprint, isspace, isupper, ispunct, isgraph, isxdigit, isalpha_l,
  53 isalnum_l, isblank_l, iscntrl_l, isdigit_l, islower_l, isprint_l,
  54 isspace_l, isupper_l, ispunct_l, isgraph_l, isxdigit_l \- character handling
  55 .SH SYNOPSIS

  56 .nf
  57 #include <ctype.h>
  58 
  59 \fBint\fR \fBisalpha\fR(\fBint\fR \fIc\fR);
  60 .fi
  61 .LP
  62 .nf
  63 \fBint\fR \fBisalnum\fR(\fBint\fR \fIc\fR);
  64 .fi
  65 .LP
  66 .nf
  67 \fBint\fR \fBisascii\fR(\fBint\fR \fIc\fR);
  68 .fi
  69 .LP
  70 .nf
  71 \fBint\fR \fBisblank\fR(\fBint\fR \fIc\fR);
  72 .fi
  73 .LP
  74 .nf
  75 \fBint\fR \fBiscntrl\fR(\fBint\fR \fIc\fR);


 138 .nf
 139 \fBint\fR \fBisprint_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 140 .fi
 141 .LP
 142 .nf
 143 \fBint\fR \fBispunct_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 144 .fi
 145 .LP
 146 .nf
 147 \fBint\fR \fBisspace_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 148 .fi
 149 .LP
 150 .nf
 151 \fBint\fR \fBisupper_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 152 .fi
 153 .LP
 154 .nf
 155 \fBint\fR \fBisxdigit_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
 156 .fi
 157 .SH DESCRIPTION

 158 These functions classify character-coded integer values. Each is a
 159 predicate returning non-zero for true, \fB0\fR for false. The behavior
 160 of these macros, except \fBisascii()\fR, is affected by the current
 161 locale (see \fBsetlocale\fR(3C) and \fBuselocale\fR(3C)). To modify
 162 the behavior, change the \fBLC_TYPE\fR category in \fBsetlocale()\fR, that is,
 163 \fBsetlocale(\fR\fBLC_CTYPE\fR, \fInewlocale\fR). In the "C" locale,
 164 or in a locale where character type information is not defined,
 165 characters are classified according to the rules of the \fBUS-ASCII\fR
 166 7-bit coded character set.
 167 .LP
 168 The functions \fBisalnum_l()\fR, \fBisalpha_l()\fR, \fBisblank_l()\fR,
 169 \fBiscntrl_l\fR, \fBisdigit_l()\fR, \fBisgraph_l()\fR,
 170 \fBislower_l()\fR, \fBisprint_l()\fR, \fBispunct_l()\fR,
 171 \fBisspace_l()\fR, \fBisupper_l()\fR, and \fBisxdigit_l()\fR all behave
 172 identically to their counterparts without the '\fB_l\fR' prefix, except
 173 that instead of acting on the current locale, they perform the test on
 174 the locale specified in the argument \fIloc\fR.
 175 .LP
 176 The \fBisascii()\fR macro is defined on all integer values. The rest are
 177 defined only where the argument is an \fBint\fR, the value of which is
 178 representable as an \fBunsigned char\fR, or \fBEOF\fR, which is defined by the
 179 <\fBstdio.h\fR> header and represents end-of-file.
 180 .sp
 181 .ne 2
 182 .na
 183 \fBisalpha()\fR
 184 .ad
 185 .RS 13n
 186 Tests for any character for which \fBisupper()\fR or \fBislower()\fR is true,
 187 or any character that is one of the current locale-defined set of characters
 188 for which none of \fBiscntrl()\fR, \fBisdigit()\fR, \fBispunct()\fR, or
 189 \fBisspace()\fR is true. In "C" locale, \fBisalpha()\fR returns true only for
 190 the characters for which \fBisupper()\fR or \fBislower()\fR is true.
 191 .RE
 192 
 193 .sp
 194 .ne 2
 195 .na
 196 \fBisalnum()\fR
 197 .ad
 198 .RS 13n
 199 Tests for any character for which \fBisalpha()\fR or \fBisdigit()\fR is true
 200 (letter or digit).
 201 .RE
 202 
 203 .sp
 204 .ne 2
 205 .na
 206 \fBisascii()\fR
 207 .ad
 208 .RS 13n
 209 Tests for any ASCII character, code between \fB0\fR and \fB0177\fR inclusive.
 210 .RE
 211 
 212 .sp
 213 .ne 2
 214 .na
 215 \fBisblank()\fR
 216 .ad
 217 .RS 13n
 218 Tests whether \fIc\fR is a character of class blank in the current locale. This
 219 macro/function is not available to applications conforming to standards prior
 220 to SUSv3. See \fBstandards\fR(5)
 221 .RE
 222 
 223 .sp
 224 .ne 2
 225 .na
 226 \fBiscntrl()\fR
 227 .ad
 228 .RS 13n
 229 Tests for any ``control character'' as defined by the character set.
 230 .RE
 231 
 232 .sp
 233 .ne 2
 234 .na
 235 \fBisdigit()\fR
 236 .ad
 237 .RS 13n
 238 Tests for any decimal-digit character.
 239 .RE
 240 
 241 .sp
 242 .ne 2
 243 .na
 244 \fBisgraph()\fR
 245 .ad
 246 .RS 13n
 247 Tests for any character for which \fBisalnum()\fR and \fBispunct()\fR are true,
 248 or any character in the current locale-defined "graph" class which is neither a
 249 space ("\|") nor a character for which \fBiscntrl()\fR is true.
 250 .RE
 251 
 252 .sp
 253 .ne 2
 254 .na
 255 \fBislower()\fR
 256 .ad
 257 .RS 13n
 258 Tests for any character that is a lower-case letter or is one of the current
 259 locale-defined set of characters for which none of \fBiscntrl()\fR,
 260 \fBisdigit()\fR, \fBispunct()\fR, \fBisspace()\fR, or \fBisupper()\fR is true.
 261 In the "C" locale, \fBislower()\fR returns true only for the characters defined
 262 as lower-case \fBASCII\fR characters.
 263 .RE
 264 
 265 .sp
 266 .ne 2
 267 .na
 268 \fBisprint()\fR
 269 .ad
 270 .RS 13n
 271 Tests for any character for which \fBiscntrl()\fR is false, and
 272 \fBisalnum()\fR, \fBisgraph()\fR, \fBispunct()\fR, the space character ("\|"),
 273 and the characters in the current locale-defined "print" class are true.
 274 .RE
 275 
 276 .sp
 277 .ne 2
 278 .na
 279 \fBispunct()\fR
 280 .ad
 281 .RS 13n
 282 Tests for any printing character which is neither a space ("\|") nor a
 283 character for which \fBisalnum()\fR or \fBiscntrl()\fR is true.
 284 .RE
 285 
 286 .sp
 287 .ne 2
 288 .na
 289 \fBisspace()\fR
 290 .ad
 291 .RS 13n
 292 Tests for any space, tab, carriage-return, newline, vertical-tab or form-feed
 293 (standard white-space characters) or for one of the current locale-defined set
 294 of characters for which \fBisalnum()\fR is false.  In the "C" locale,
 295 \fBisspace()\fR returns true only for the standard white-space characters.
 296 .RE
 297 
 298 .sp
 299 .ne 2
 300 .na
 301 \fBisupper()\fR
 302 .ad
 303 .RS 13n
 304 Tests for any character that is an upper-case letter or is one of the current
 305 locale-defined set of characters for which none of \fBiscntrl()\fR,
 306 \fBisdigit()\fR, \fBispunct()\fR, \fBisspace()\fR, or \fBislower()\fR is true.
 307 In the "C" locale, \fBisupper()\fR returns true only for the characters defined
 308 as upper-case \fBASCII\fR characters.
 309 .RE
 310 
 311 .sp
 312 .ne 2
 313 .na
 314 \fBisxdigit()\fR
 315 .ad
 316 .RS 14n
 317 Tests for any hexadecimal-digit character (\fB[0\(mi9]\fR, \fB[A\(miF]\fR, or
 318 \fB[a\(mif]\fR or the current locale-defined sets of characters representing
 319 the hexadecimal digits \fB10\fR to \fB15\fR inclusive). In the "C" locale, only
 320 .sp
 321 .in +2
 322 .nf
 323 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
 324 .fi
 325 .in -2
 326 
 327 are included.
 328 .RE
 329 
 330 .SH RETURN VALUES

 331 If the argument to any of the character handling macros is not in the domain of
 332 the function, the result is undefined. Otherwise, the macro or function returns
 333 non-zero if the classification is \fBTRUE\fR and \fB0\fR if the classification
 334 is \fBFALSE\fR.
 335 .SH ATTRIBUTES

 336 See \fBattributes\fR(5) for descriptions of the following attributes:
 337 .TS
 338 box;
 339 c | c
 340 l | l .
 341 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 342 _
 343 CSI     Enabled
 344 _
 345 Interface Stability     Standard
 346 _
 347 MT-Level        MT-Safe
 348 .TE
 349 
 350 .SH SEE ALSO

 351 \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C),
 352 \fBstdio\fR(3C), \fBascii\fR(5), \fBenviron\fR(5),
 353 \fBstandards\fR(5)