Character Classification

 

The latest version of this topic can be found at 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 between 0 and 127 are a subset of all multibyte-character sets. For example, Japanese katakana includes ASCII as well as non-ASCII characters.)

The test conditions are affected by the setting of the LC_CTYPE category setting of the locale; see setlocale for more information. The versions of these functions without the _l suffix use the current locale for this locale-dependent behavior; the versions with the _l suffix are identical except that they use the locale parameter passed in instead.

Generally these routines execute faster than tests you might write and should be favored over. 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 .NET Framework equivalent
isalnum, iswalnum, _isalnum_l, _iswalnum_l, _ismbcalnum, _ismbcalnum_l, _ismbcalpha, _ismbcalpha_l, _ismbcdigit, _ismbcdigit_l Alphanumeric System::Char::IsLetterOrDigit.
_ismbcalnum, _ismbcalnum_l, _ismbcalpha, _ismbcalpha_l, _ismbcdigit, _ismbcdigit_l Alphanumeric Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
isalpha, iswalpha, _isalpha_l, _iswalpha_l, _ismbcalnum, _ismbcalnum_l, _ismbcalpha, _ismbcalpha_l, _ismbcdigit, _ismbcdigit_l Alphabetic System::Char::IsLetter
isascii, __isascii, iswascii ASCII System::Char::IsLetter
isblank, iswblank, _isblank_l, _iswblank_l, _ismbcsblank, _ismbcsblank_l Blank (space or horizontal tab) Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
iscntrl, iswcntrl, _iscntrl_l, _iswcntrl_l Control System::Char::IsControl
iscsym, iscsymf, __iscsym, __iswcsym, __iscsymf, __iswcsymf, _iscsym_l, _iswcsym_l, _iscsymf_l, _iswcsymf_l Letter, underscore, or digit System::Char::IsControl
iscsym, iscsymf, __iscsym, __iswcsym, __iscsymf, __iswcsymf, _iscsym_l, _iswcsym_l, _iscsymf_l, _iswcsymf_l Letter or underscore System::Char::IsControl
isdigit, iswdigit, _isdigit_l, _iswdigit_l, _ismbcalnum, _ismbcalnum_l, _ismbcalpha, _ismbcalpha_l, _ismbcdigit, _ismbcdigit_l Decimal digit System::Char::IsDigit
isgraph, iswgraph, _isgraph_l, _iswgraph_l, _ismbcgraph, _ismbcgraph_l, _ismbcprint, _ismbcprint_l, _ismbcpunct, _ismbcpunct_l, _ismbcblank, _ismbcblank_l, _ismbcspace, _ismbcspace_l Printable other than space Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
islower, iswlower, _islower_l, _iswlower_l, _ismbclower, _ismbclower_l, _ismbcupper, _ismbcupper_l Lowercase System::Char::IsLower
_ismbchira, _ismbchira_l, _ismbckata, _ismbckata_l Hiragana Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbchira, _ismbchira_l, _ismbckata, _ismbckata_l Katakana Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbclegal, _ismbclegal_l, _ismbcsymbol, _ismbcsymbol_l Legal multibyte character Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbcl0, _ismbcl0_l, _ismbcl1, _ismbcl1_l, _ismbcl2, _ismbcl2_l Japan-level 0 multibyte character Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbcl0, _ismbcl0_l, _ismbcl1, _ismbcl1_l, _ismbcl2, _ismbcl2_l Japan-level 1 multibyte character Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbcl0, _ismbcl0_l, _ismbcl1, _ismbcl1_l, _ismbcl2, _ismbcl2_l Japan-level 2 multibyte character Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbclegal, _ismbclegal_l, _ismbcsymbol, _ismbcsymbol_l Non-alphanumeric multibyte character Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
isprint, iswprint, _isprint_l, _iswprint_l, _ismbcgraph, _ismbcgraph_l, _ismbcprint, _ismbcprint_l, _ismbcpunct, _ismbcpunct_l, _ismbcblank, _ismbcblank_l, _ismbcspace, _ismbcspace_l Printable Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
ispunct, iswpunct, _ispunct_l, _iswpunct_l, _ismbcgraph, _ismbcgraph_l, _ismbcprint, _ismbcprint_l, _ismbcpunct, _ismbcpunct_l, _ismbcblank, _ismbcblank_l, _ismbcspace, _ismbcspace_l Punctuation System::Char::IsPunctuation
isspace, iswspace, _isspace_l, _iswspace_l, _ismbcgraph, _ismbcgraph_l, _ismbcprint, _ismbcprint_l, _ismbcpunct, _ismbcpunct_l, _ismbcblank, _ismbcblank_l, _ismbcspace, _ismbcspace_l White-space System::Char::IsWhiteSpace
Isupper, iswupper, _ismbclower, _ismbclower_l, _ismbcupper, _ismbcupper_l Uppercase System::Char::IsUpper
_isctype, iswctype, _isctype_l, _iswctype_l Property specified by desc argument Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
isxdigit, iswxdigit, _isxdigit_l, _iswxdigit_l Hexadecimal digit System::Char::IsNumber
_mbclen, mblen, _mblen_l Return length of valid multibyte character; result depends on LC_CTYPE category setting of current locale Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

See Also

Run-Time Routines by Category