The standard functions that work with characters are in the
ctype.h interface.
man ctype
CTYPE(3C) Silicon Graphics CTYPE(3C)
NAME
isdigit, isxdigit, islower, isupper, isalpha, isalnum, isspace, iscntrl,
ispunct, isprint, isgraph, isascii, tolower, toupper, toascii, _tolower,
_toupper, setchrclass - character handling
SYNOPSIS
#include
int isdigit (int c);
int isxdigit (int c);
int islower (int c);
int isupper (int c);
int isalpha (int c);
int isalnum (int c);
int isspace (int c);
int iscntrl (int c);
int ispunct (int c);
int isprint (int c);
int isgraph (int c);
int isascii (int c);
int tolower (int c);
int toupper (int c);
int toascii (int c);
int _tolower (int c);
int _toupper (int c);
int setchrclass (char *chrclass);
DESCRIPTION
The character classification macros listed below return nonzero for true,
zero for false. isascii is defined on all integer values; the rest are
defined on valid members of the character set and on the single value EOF
[see stdio(3S)] (guaranteed not to be a character set member).
isdigit tests for the digits 0 through 9.
isxdigit tests for any character for which isdigit is true or for
the letters a through f or A through F.
islower tests for any lowercase letter as defined by the character
set.
isupper tests for any uppercase letter as defined by the character
set.
isalpha tests for any character for which islower or isupper is
true and possibly any others as defined by the character
set.
isalnum tests for any character for which isalpha or isdigit is
true.
isspace tests for a space, horizontal-tab, carriage return,
newline, vertical-tab, or form-feed.
iscntrl tests for ``control characters'' as defined by the
character set.
ispunct tests for any character other than the ones for which
isalnum, iscntrl, or isspace is true or space.
isprint tests for a space or any character for which isalnum or
ispunct is true or other ``printing character'' as defined
by the character set.
isgraph tests for any character for which isprint is true, except
for space.
isascii tests for an ASCII character (a non-negative number less
than 0200.)
The conversion functions and macros translate a character from lowercase
(uppercase) to uppercase (lowercase).
tolower if the character is one for which isupper is true and
there a corresponding lowercase character, tolower returns
the corresponding lowercase character. Otherwise, the
character is returned unchanged.
toupper if the character is one for which islower is true and
there is a corresponding uppercase character, toupper
returns the corresponding uppercase character. Otherwise,
the character is returned unchanged.
toascii turns off the bits that are not part of the ASCII
character set.
_tolower returns the lowercase representation of a character for
which isupper is true, otherwise undefined.
_toupper returns the uppercase representation of a character for
which islower is true, otherwise undefined.
The conversion macros have the same functionality of the functions on
valid input, but the macros are faster because they do not do range
checking.
All the character classification macros and the conversion functions and
macros do a table lookup.
setchrclass initializes the table used by these functions and macros to a
specific character classification set. setchrclass uses the value of its
argument or the value of the environment variable CHRCLASS as the name of
the datafile containing the information for the desired character set.
These datafiles are searched for in the special directory /lib/chrclass.
If chrclass is (char *)0, the value of the environment variable CHRCLASS
is used. If CHRCLASS is not set or is undefined, the table retains its
default value. The default value is the iso8859 character set unless the
executable was compiled in a strict ANSI mode (-ansi or -ansiposix)), in
which case the default character table is ascii.
FILES
/lib/chrclass - directory containing the datafiles for setchrclass
SEE ALSO
chrtbl(1M), stdio(3S), ascii(5), locale(3C), environ(5).
DIAGNOSTICS
If the argument to any of the character handling macros is not in the
domain of the function, the result is undefined.
If setchrclass does not successfully fill the table, the table will not
change (initially ``ascii'') and -1 is returned. If everything works,
setchrclass returns 0.