[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

General Programming Concepts: Writing and Debugging Programs


List of Character Manipulation Subroutines

The character manipulation functions and macros test and translate ASCII characters.

These functions and macros are of three kinds:

The Programming Example for Manipulating Characters illustrates some of the character manipulation routines.

Character Testing

Use the following functions and macros to determine character type. Punctuation, alphabetic, and case-querying functions values depend on the current collation table.

The ctype subroutines contain the following functions:

isalpha Is character alphabetic?
isalnum Is character alphanumeric?
isupper Is character uppercase?
islower Is character lowercase?
isdigit Is character a digit?
isxdigit Is character a hex digit?
isspace Is character a blank-space character?
ispunct Is character a punctuation character?
isprint Is character a printing character, including space?
isgraph Is character a printing character, excluding space?
iscntrl Is character a control character?
isascii Is character an integer ASCII character?

Character Translation

The conv subroutines contain the following functions:

toupper Converts a lowercase letter to uppercase
_toupper (Macro) Converts a lowercase letter to uppercase
tolower Converts an uppercase letter to lowercase
_tolower (Macro) Converts an uppercase letter to lowercase
toascii Converts an integer to an ASCII character

Miscellaneous Character Manipulation


getc, fgetc,getchar, getw Get a character or word from an input stream
putc,putchar, fputc, putw Write a character or word to a stream

Related Information

Chapter 16, National Language Support

Programming Example for Manipulating Characters

Chapter 24, Subroutines, Example Programs, and Libraries


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]