Character Classification
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

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 Nonalphanumeric 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

See Also

Run-Time Routines by Category | Run-Time Routines and .NET Framework Equivalents

© 2016 Microsoft