List of character manipulation subroutines

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

These functions and macros are of three kinds:

  • Character testing
  • Character translation
  • Miscellaneous character manipulation

The Character Testing 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