Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ctype(3)

setlocale(3)

ctype(3)  —  Subroutines

OSF

NAME

isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, isgraph, iscntrl, isascii − Classifies characters

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <ctype.h>

int isalpha(
    int c) ;

int isupper(
    int c) ;

int islower(
    int c) ;

int isdigit(
    int c) ;

int isxdigit(
    int c) ;

int isalnum(
    int c) ;

int isspace(
    int c) ;

int ispunct(
    int c) ;

int isprint(
    int c) ;

int isgraph(
    int c) ;

int iscntrl(
    int c) ;

int isascii(
    int c) ;

PARAMETERS

cSpecifies the character to be tested. In all cases, this parameter is an  int data type, whose value must be representable as an unsigned char or must equal the value of the macro EOF (defined in the stdio.h include file). When this parameter has a value that can not be represented as an unsigned char or EOF, the result is undefined. 

DESCRIPTION

The ctype functions classify character-coded integer values specified in a table. Each of these functions returns a nonzero value for TRUE and 0 (zero) for FALSE. 

The ctype functions, which are defined in the ctype.h include file, are defined as subroutines in the sys/locale.h include file. These functions classify character-coded integer values specified in a table.  Each function returns a nonzero value for TRUE and 0 (zero) for FALSE. 

For international character support, these operations are implemented as functions. To increase performance in a U.S. English-only environment, the ctype functions are used. However, when the sys/locale.h include file is referenced, the assumption is that international character support is desired, so  subroutines are used in place of macros. 

The isascii() function is defined for all integer values. All other functions return a meaningful value only when isascii() returns TRUE for the same c parameter value or when c is EOF. (See Standard Input/Output Library for information
 
 
 
 
 
 
 
about the value EOF.) 

Function Values

The following lists the set of values for which each function listed in the ctype.h include file returns a nonzero (TRUE) value:

isalnum()When c is a letter or a digit. 

isalphaWhen c is a letter. 

isupperWhen c is an uppercase letter. 

islowerWhen c is a lowercase letter. 

isdigitWhen c is a digit in the range [0-9]. 

isxdigit()When c is a hexadecimal digit in the range [0-9], [A-F], or [a-f]. 

isspace()When c is a space, tab, carriage return, newline, vertical tab, or form feed character. 

ispunct()When c is a punctuation character (neither a control character nor an alphanumeric character). 

isprint()When c is a printing character, ASCII space (040 or 0x20) through ~ (0176 or 0x7E). 

isgraph()When c is a printing character, like isprint().  Unlike isprint(), isgraph() returns FALSE for the space character. 

iscntrl()When c is an ASCII delete character (0177 or 0x7F), or an ordinary control character (less than 040 or 0x20). 

isascii()When c is an ASCII character whose value is in the range 0-0177 (0-0x7F), inclusive. 

NOTES

The setlocale() function affects all conversions.  See the setlocale() function for more information. 

In the C locale, or in a locale where character-type information is not defined, characters are classified according to the rules of the US-ASCII 7-bit coded character set. For any character value greater than octal 177 (0177 in C-language context) the value 0 (zero) is returned. 

AES Support Level:
Full use

RETURN VALUES

Upon successful completion of any function, a nonzero (TRUE) value is returned.  Otherwise, the value 0 (FALSE) is returned. 

RELATED INFORMATION

Functions: ctype(3), setlocale(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026