Character Classification

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

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

RoutineCharacter test condition.NET Framework equivalent
isalnum, iswalnum, _isalnum_l, _iswalnum_l, _ismbcalnum, _ismbcalnum_l, _ismbcalpha, _ismbcalpha_l, _ismbcdigit, _ismbcdigit_lAlphanumericSystem::Char::IsLetterOrDigit.
_ismbcalnum, _ismbcalnum_l, _ismbcalpha, _ismbcalpha_l, _ismbcdigit, _ismbcdigit_lAlphanumericNot 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_lAlphabeticSystem::Char::IsLetter
isascii, __isascii, iswasciiASCIISystem::Char::IsLetter
isblank, iswblank, _isblank_l, _iswblank_l, _ismbcsblank, _ismbcsblank_lBlank (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_lControlSystem::Char::IsControl
iscsym, iscsymf, __iscsym, __iswcsym, __iscsymf, __iswcsymf, _iscsym_l, _iswcsym_l, _iscsymf_l, _iswcsymf_lLetter, underscore, or digitSystem::Char::IsControl
iscsym, iscsymf, __iscsym, __iswcsym, __iscsymf, __iswcsymf, _iscsym_l, _iswcsym_l, _iscsymf_l, _iswcsymf_lLetter or underscoreSystem::Char::IsControl
isdigit, iswdigit, _isdigit_l, _iswdigit_l, _ismbcalnum, _ismbcalnum_l, _ismbcalpha, _ismbcalpha_l, _ismbcdigit, _ismbcdigit_lDecimal digitSystem::Char::IsDigit
isgraph, iswgraph, _isgraph_l, _iswgraph_l, _ismbcgraph, _ismbcgraph_l, _ismbcprint, _ismbcprint_l, _ismbcpunct, _ismbcpunct_l, _ismbcblank, _ismbcblank_l, _ismbcspace, _ismbcspace_lPrintable other than spaceNot 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_lLowercaseSystem::Char::IsLower
_ismbchira, _ismbchira_l, _ismbckata, _ismbckata_lHiraganaNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbchira, _ismbchira_l, _ismbckata, _ismbckata_lKatakanaNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbclegal, _ismbclegal_l, _ismbcsymbol, _ismbcsymbol_lLegal multibyte characterNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbcl0, _ismbcl0_l, _ismbcl1, _ismbcl1_l, _ismbcl2, _ismbcl2_lJapan-level 0 multibyte characterNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbcl0, _ismbcl0_l, _ismbcl1, _ismbcl1_l, _ismbcl2, _ismbcl2_lJapan-level 1 multibyte characterNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbcl0, _ismbcl0_l, _ismbcl1, _ismbcl1_l, _ismbcl2, _ismbcl2_lJapan-level 2 multibyte characterNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_ismbclegal, _ismbclegal_l, _ismbcsymbol, _ismbcsymbol_lNon-alphanumeric multibyte characterNot 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_lPrintableNot 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_lPunctuationSystem::Char::IsPunctuation
isspace, iswspace, _isspace_l, _iswspace_l, _ismbcgraph, _ismbcgraph_l, _ismbcprint, _ismbcprint_l, _ismbcpunct, _ismbcpunct_l, _ismbcblank, _ismbcblank_l, _ismbcspace, _ismbcspace_lWhite-spaceSystem::Char::IsWhiteSpace
Isupper, iswupper, _ismbclower, _ismbclower_l, _ismbcupper, _ismbcupper_lUppercaseSystem::Char::IsUpper
_isctype, iswctype, _isctype_l, _iswctype_lProperty specified by desc argumentNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
isxdigit, iswxdigit, _isxdigit_l, _iswxdigit_lHexadecimal digitSystem::Char::IsNumber
_mbclen, mblen, _mblen_lReturn length of valid multibyte character; result depends on LC_CTYPE category setting of current localeNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

Run-Time Routines by Category

Show: