Share via


Character Classification

Each of these routines tests a specified single-byte character, wide character, or multibyte character for satisfaction of a condition. (By definition, the ASCII character set is a subset of all multibyte-character sets. For example, Japanese katakana includes ASCII as well as non-ASCII characters.) Generally these routines execute faster than tests you might write. For example, the following code executes slower than a call to isalpha(c):

if ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))
    return TRUE;

Character-Classification Routines

Routine Character Test Condition
isalnum, iswalnum, _ismbcalnum Alphanumeric
isalpha, iswalpha, _ismbcalpha Alphabetic
__isascii, iswascii ASCII
iscntrl, iswcntrl Control
__iscsym Letter, underscore, or digit
__iscsymf Letter or underscore
isdigit, iswdigit, _ismbcdigit Decimal digit
isgraph, iswgraph, _ismbcgraph Printable other than space
islower, iswlower, _ismbclower Lowercase
_ismbchira Hiragana
_ismbckata Katakana
_ismbclegal Legal multibyte character
_ismbcl0 Japan-level 0 multibyte character
_ismbcl1 Japan-level 1 multibyte character
_ismbcl2 Japan-level 2 multibyte character
_ismbcsymbol Non-alphanumeric multibyte character
isprint, iswprint, _ismbcprint Printable
ispunct, iswpunct, _ismbcpunct Punctuation
isspace, iswspace, _ismbcspace White-space
isupper, iswupper, _ismbcupper Uppercase
iswctype Property specified by desc argument
isxdigit, iswxdigit Hexadecimal digit
mblen Return length of valid multibyte character; result depends on LC_CTYPE category setting of current locale