字节分类Byte Classification

其中的每个例程均针对条件满意度测试多字节字符的指定字节。Each of these routines tests a specified byte of a multibyte character for satisfaction of a condition. 除非另有指定,否则输出值受区域设置的 LC_CTYPE 类别设置影响;有关详细信息,请参阅 setlocaleExcept where specified otherwise, the output value is affected by the setting of the LC_CTYPE category setting of the locale; see setlocale for more information. 这些不带 _l 后缀的函数的版本使用为该区域设置相关的行为的当前区域设置;带有 _l 后缀的版本相同,只不过它们使用传递的区域设置参数。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.

备注

根据定义,0 和 127 之间的 ASCII 字符是所有多字节字符集的子集。By definition, the ASCII characters between 0 and 127 are a subset of all multibyte-character sets. 例如,日语的片假名字符集包括 ASCII 以及非 ASCII 字符。For example, the Japanese katakana character set includes ASCII as well as non-ASCII characters.

下表中的预定义常量在 CTYPE.H 中定义。The predefined constants in the following table are defined in CTYPE.H.

多字节字符的字节分类例程Multibyte-Character Byte-Classification Routines

例程Routine 字节测试条件Byte Test Condition
isleadbyte、_isleadbyte_lisleadbyte, _isleadbyte_l 前导字节;测试结果取决于当前区域设置的 LC_CTYPE 类别设置Lead byte; test result depends on LC_CTYPE category setting of current locale
_ismbbalnum、_ismbbalnum_l_ismbbalnum, _ismbbalnum_l isalnum || _ismbbkalnum
_ismbbalpha、_ismbbalpha_l_ismbbalpha, _ismbbalpha_l isalpha || _ismbbkalnum
_ismbbgraph、_ismbbgraph_l_ismbbgraph, _ismbbgraph_l _ismbbprint 相同,但是 _ismbbgraph 不包含空格字符 (0x20)Same as _ismbbprint, but _ismbbgraph does not include the space character (0x20)
_ismbbkalnum、_ismbbkalnum_l_ismbbkalnum, _ismbbkalnum_l 标点以外的非 ASCII 文本符号。Non-ASCII text symbol other than punctuation. 例如,仅在代码页 932 中,_ismbbkalnum 测试片假名字母数字For example, in code page 932 only, _ismbbkalnum tests for katakana alphanumeric
_ismbbkana、_ismbbkana_l_ismbbkana, _ismbbkana_l 片假名 (0xA1 - 0xDF),仅代码页 932Katakana (0xA1 - 0xDF), code page 932 only
_ismbbkprint、_ismbbkprint_l_ismbbkprint, _ismbbkprint_l 非 ASCII 文本或非 ASCII 标点符号。Non-ASCII text or non-ASCII punctuation symbol. 例如,仅在代码页 932 中,_ismbbkprint 测试片假名字母数字或片假名标点(范围:0xA1 - 0xDF)。For example, in code page 932 only, _ismbbkprint tests for katakana alphanumeric or katakana punctuation (range: 0xA1 - 0xDF).
_ismbbkpunct、_ismbbkpunct_l_ismbbkpunct, _ismbbkpunct_l 非 ASCII 标点。Non-ASCII punctuation. 例如,仅在代码页 932 中,_ismbbkpunct 测试片假名标点。For example, in code page 932 only, _ismbbkpunct tests for katakana punctuation.
_ismbblead、_ismbblead_l_ismbblead, _ismbblead_l 多字节字符的第一个字节。First byte of multibyte character. 例如,仅在代码页 932 中,有效范围为 0x81 - 0x9F 以及 0xE0 - 0xFC。For example, in code page 932 only, valid ranges are 0x81 - 0x9F, 0xE0 - 0xFC.
_ismbbprint、_ismbbprint_l_ismbbprint, _ismbbprint_l isprint || _ismbbkprint. ismbbprint 包含空格字符 (0x20)isprint || _ismbbkprint. ismbbprint includes the space character (0x20)
_ismbbpunct、_ismbbpunct_l_ismbbpunct, _ismbbpunct_l ispunct || _ismbbkpunct
_ismbbtrail、_ismbbtrail_l_ismbbtrail, _ismbbtrail_l 多字节字符的第二个字节。Second byte of multibyte character. 例如,仅在代码页 932 中,有效范围为 0x40 - 0x7E 以及 0x80 - 0xEC。For example, in code page 932 only, valid ranges are 0x40 - 0x7E, 0x80 - 0xEC.
_ismbslead、_ismbslead_l_ismbslead, _ismbslead_l 前导字节(在字符串上下文中)Lead byte (in string context)
ismbstrail、_ismbstrail_lismbstrail, _ismbstrail_l 结尾字节(在字符串上下文中)Trail byte (in string context)
_mbbtype、_mbbtype_l_mbbtype, _mbbtype_l 基于上一个字节返回字节类型Return byte type based on previous byte
_mbsbtype、_mbsbtype_l_mbsbtype, _mbsbtype_l 返回字符串内的字节类型Return type of byte within string
mbsinitmbsinit 跟踪多字节字符转换的状态。Tracks the state of a multibyte character conversion.

在 LIMITS.H 中定义的 MB_LEN_MAX 宏扩展到任一多字节字符可具有的最大字节长度。The MB_LEN_MAX macro, defined in LIMITS.H, expands to the maximum length in bytes that any multibyte character can have. 在 STDLIB.H 中定义的 MB_CUR_MAX 扩展到当前区域设置中任一多字节字符的最大字节长度。MB_CUR_MAX, defined in STDLIB.H, expands to the maximum length in bytes of any multibyte character in the current locale.

另请参阅See Also

按类别分的运行时例程Run-Time Routines by Category