RAD Studio
ContentsIndex
PreviousUpNext
ctype.h

The following functions, macros, and classes are provided in ctype.h:

Name 
Description 
Header File
ctype.h
Syntax
extern char _ctype[];
Description
_ctype is an array of character attribute information indexed by ASCII value + 1. Each entry is a set of bits describing the character. This array is used by isdigit, isprint, and so on. 
Header File
ctype.h
Description
Bit settings in the _ctype[] used by the is... character macros.  
Header File
ctype.h
Category
Conversion Routines
Prototype
int _tolower(int ch);
Description
_tolower is a macro that does the same conversion as tolower, except that it should be used only when ch is known to be uppercase (AZ).
To use _tolower, you must include ctype.h.
Return Value
_tolower returns the converted value of ch if it is uppercase; otherwise, the result is undefined.
Example  
Header File
ctype.h
Category
Conversion Routines
Prototype
int _toupper(int ch);
Description
Translates characters to uppercase.
_toupper is a macro that does the same conversion as toupper, except that it should be used only when ch is known to be lowercase (a to z).
To use _toupper, you must include ctype.h.
Return Value
_toupper returns the converted value of ch if it is lowercase; otherwise, the result is undefined.
Example  
Header File
ctype.h, mbstring.h
Category
Classification Routines
Prototype
int isalnum(int c);
int __iscsym(int c);
int iswalnum(wint_t c);
int _ismbcalnum(unsigned int c);
Description
Tests for an alphanumeric character.
isalnum is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is a letter (A to Z or a to z) or a digit (0 to 9).
You can make this macro available as a function by undefining (#undef) it.
Return Value
It is a predicate returning nonzero for true and 0 for false.... more 
Header File
ctype.h, mbstring.h
Category
Classification Routines
Prototype
int isalpha(int c);
int __iscsymf(int c);
int iswalpha(wint_t c);
int _ismbcalpha(unsigned int c);
Description
Classifies an alphabetical character.
isalpha is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is a letter (A to Z or a to z).
You can make this macro available as a function by undefining (#undef) it.
Return Value
isalpha returns nonzero if c is a letter.
__iscsymf returns true if and only if the argument c is... more 
Header File
ctype.h, wctype.h
Category
Classification Routines
Prototype
int isascii(int c);
int iswascii(wint_t c);
Description
Character classification macro.
These functions depend on the LC_CTYPE
isascii is a macro that classifies ASCII-coded integer values by table lookup. It is a predicate returning nonzero for true and 0 for false.
isascii is defined on all integer values.
Return Value
isascii returns nonzero if c is in the range 0 to 127 (0x00-0x7F).
iswascii returns nonzero if c is is a wide-character representation of an ASCII character.
Each of these routines returns 0 if c does not satisfy the test condition.
Example... more 
Header File
ctype.h
Category
Classification Routines
Prototype
int iscntrl(int c);
int iswcntrl(wint_t c);
Description
Tests for a control character.
iscntrl is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is a delete character or control character (0x7F or 0x00 to 0x1F).
You can make this macro available as a function by undefining (#undef) it.
Return Value
iscntrl returns nonzero if c is a delete character or ordinary control character.
Example  
Header File
ctype.h, mbstring.h
Category
Classification Routines
Prototype
int isdigit(int c);
int iswdigit(wint_t c);
int _ismbcdigit(unsigned int c);
Description
Tests for decimal-digit character.
isdigit is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is a digit (0 to 9).
You can make this macro available as a function by undefining (#undef) it.
Return Value
isdigit returns nonzero if c is a digit.
_ismbcdigit returns true if and only if the argument c is a single-byte representation of an ASCII digit.... more 
Header File
ctype.h, mbstring.h
Category
Classification Routines
Prototype
int isgraph(int c);
int iswgraph(wint_t c);
int _ismbcgraph( unsigned int c);
Description
Tests for printing character.
isgraph is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is a printing character except blank space (‘ ‘).
You can make this macro available as a function by undefining (#undef) it.
Return Value
isgraph returns nonzero if c is a printing character.
Example  
Header File
ctype.h, mbstring.h
Category
Classification Routines
Prototype
int islower(int c);
int iswlower(wint_t c);
int _ismbclower(unsigned int c);
Description
Tests for lowercase character.
islower is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is a lowercase letter (a to z).
You can make this macro available as a function by undefining (#undef) it.
Return Value
islower returns nonzero if c is a lowercase letter.
Example  
Header File
ctype.h, wctype.h, mbstring.h
Category
Classification Routines
Prototype
int isprint(int c);
int iswprint(wint_t c);
int _ismbcprint(unsigned int c);
Description
Tests for printing character.
isprint is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is a printing character including the blank space (‘ ‘).
You can make this macro available as a function by undefining (#undef) it.
Return Value
isprint returns nonzero if c is a printing character.
Example  
Header File
ctype.h, wctype.h, mbstring.h
Category
Classification Routines
Prototype
int ispunct(int c);
int iswpunct(wint_t c);
int _ismbcpunct(unsigned int c);
Description
Tests for punctuation character.
ispunct is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is any printing character that is neither an alphanumeric nor a blank space (‘ ‘).
You can make this macro available as a function by undefining (#undef) it.
Return Value
ispunct returns nonzero if c is a punctuation character.
Example  
Header File
ctype.h, wctype.h, mbstring.h
Category
Classification Routines
Prototype
int isspace(int c);
int iswspace(wint_t c);
int _ismbcspace(unsigned int c);
Description
Tests for space character.
isspace is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category.
You can make this macro available as a function by undefining (#undef) it.
Return Value
isspace returns nonzero if c is a space, tab, carriage return, new line, vertical tab, formfeed (0x09 to 0x0D, 0x20), or any other locale-defined space character.
Example  
Header File
ctype.h, wctype.h, mbstring.h
Category
Classification Routines
Prototype
int isupper(int c);
int iswupper(wint_t c);
int _ismbcupper(unsigned int c);
Description
Tests for uppercase character.
isupper is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is an uppercase letter (A to Z).
You can make this macro available as a function by undefining (#undef) it.
Return Value
isupper returns nonzero if c is an uppercase letter.
Example  
Header File
ctype.h, wctype.h
Category
Classification Routines
Prototype
int isxdigit(int c);
int iswxdigit(wint_t c);
Description
Tests for hexadecimal character.
isxdigit is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category.
You can make this macro available as a function by undefining (#undef) it.
Return Value
isxdigit returns nonzero if c is a hexadecimal digit (0 to 9, A to F, a to f) or any other hexadecimal digit defined by the locale.
Example  
Header File
ctype.h
Category
Conversion Routines
Prototype
int toascii(int c);
Description
Translates characters to ASCII format.
toascii is a macro that converts the integer c to ASCII by clearing all but the lower 7 bits; this gives a value in the range 0 to 127.
Return Value
toascii returns the converted value of c.
Portability  
Header File
ctype.h, mbstring.h
Category
Conversion Routines
Prototype
int tolower(int ch);
int towlower(wint_t ch); // Unicode version
unsigned int _mbctolower(unsigned int c);
Description
Translates characters to lowercase.
tolower is a function that converts an integer ch (in the range EOF to 255) to its lowercase value (a to z; if it was uppercase, A to Z). All others are left unchanged.
Return Value
tolower returns the converted value of ch if it is uppercase; it returns all others unchanged.
Example  
Header File
ctype.h, mbstring.h
Category
Conversion Routines
Prototype
int toupper(int ch);
int towupper(wint_t ch); // Unicode version
unsigned int _mbctoupper(unsigned int c);
Description
Translates characters to uppercase.
toupper is a function that converts an integer ch (in the range EOF to 255) to its uppercase value (A to Z; if it was lowercase, a to z). All others are left unchanged.
towupper is the Unicode version of toupper. It is available when Unicode is defined.
Return Value
toupper returns the converted value of ch if it is lowercase; it returns all others unchanged.
Example  
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!