数据转换Data Conversion

这些例程可将数据从一种形式转换为另一种形式。These routines convert data from one form to another. 通常,这些例程比可能编写的转换执行速度更快。Generally these routines execute faster than conversions you might write. 每个以 to 前缀开头的例程都作为函数和宏实现。Each routine that begins with a to prefix is implemented as a function and as a macro. 请参阅在函数和宏之间选择,了解关于选择实现的信息。See Choosing Between Functions and Macros for information about choosing an implementation.

数据转换例程Data-conversion routines

例程所返回的值Routine 使用Use
absabs 查找整数的绝对值Find absolute value of integer
atof、_atof_latof, _atof_l 将字符串转换为单精度浮点型Convert string to float
atoi、_atoi_latoi, _atoi_l 将字符串转换为整型Convert string to int
_atoi64、_atoi64_l_atoi64, _atoi64_l 将字符串转换为 __int64 型或超长整型Convert string to __int64 or long long
atol、_atol_latol, _atol_l 将字符串转换为长整型Convert string to long
c16rtomb、c32rtombc16rtomb, c32rtomb 将 UTF-16 或 UTF-32 字符转换为等效多字节字符Convert UTF-16 or UTF-32 character to equivalent multibyte character
_ecvt_ecvt_s_ecvt, _ecvt_s 将双精度浮点型转换为指定长度的字符串Convert double to string of specified length
_fcvt_fcvt_s_fcvt, _fcvt_s 将双精度浮点型转换为小数点后具有指定位数的字符串Convert double to string with specified number of digits following decimal point
_gcvt_gcvt_s_gcvt, _gcvt_s 将双精度浮点型数字转换为字符串;将字符串存储于缓存分区中Convert double number to string; store string in buffer
_itoa、_ltoa、_ultoa、_i64toa、_ui64toa、_itow、_ltow、ultow、_i64tow、_ui64tow_itoa_s、_ltoa_s、_ultoa_s、_i64toa_s、_ui64toa_s、_itow_s、_ltow_s、_ultow_s、_i64tow_s、_ui64tow_s_itoa, _ltoa, _ultoa, _i64toa, _ui64toa, _itow, _ltow, ultow, _i64tow, _ui64tow, _itoa_s, _ltoa_s, _ultoa_s, _i64toa_s, _ui64toa_s, _itow_s, _ltow_s, _ultow_s, _i64tow_s, _ui64tow_s 将整数类型转换为字符串Convert integer types to string
labslabs 查找长整型整数的绝对值Find absolute value of long integer
llabsllabs 查找超长整型整数的绝对值Find absolute value of long long integer
_mbbtombc、_mbbtombc_l_mbbtombc, _mbbtombc_l 将 1 字节多字节字符转换为相应的 2 字节多字节字符Convert 1-byte multibyte character to corresponding 2-byte multibyte character
_mbcjistojms、_mbcjistojms_l、_mbcjmstojis、_mbcjmstojis_l_mbcjistojms, _mbcjistojms_l, _mbcjmstojis, _mbcjmstojis_l 将日本行业标准 (JIS) 字符转换为日本 Microsoft (JMS) 字符Convert Japan Industry Standard (JIS) character to Japan Microsoft (JMS) character
_mbcjistojms、_mbcjistojms_l、_mbcjmstojis、_mbcjmstojis_l_mbcjistojms, _mbcjistojms_l, _mbcjmstojis, _mbcjmstojis_l 将 JMS 字符转换为 JIS 字符Convert JMS character to JIS character
_mbctohira、_mbctohira_l、_mbctokata、_mbctokata_l_mbctohira, _mbctohira_l, _mbctokata, _mbctokata_l 将多字节字符转换为 1 字节平假名代码Convert multibyte character to 1-byte hiragana code
_mbctohira、_mbctohira_l、_mbctokata、_mbctokata_l_mbctohira, _mbctohira_l, _mbctokata, _mbctokata_l 将多字节字符转换为 1 字节片假名代码Convert multibyte character to 1-byte katakana code
_mbctombb、_mbctombb_l_mbctombb, _mbctombb_l 将 2 字节多字节字符转换为相应的 1 字节多字节字符Convert 2-byte multibyte character to corresponding 1-byte multibyte character
mbrtoc16、mbrtoc32mbrtoc16, mbrtoc32 将多字节字符转换为等效 UTF-16 或 UTF-32 字符Convert multibyte character to equivalent UTF-16 or UTF-32 character
mbstowcs、_mbstowcs_lmbstowcs_s、_mbstowcs_s_lmbstowcs, _mbstowcs_l, mbstowcs_s, _mbstowcs_s_l 将多字节字符序列转换为对应的宽字符序列Convert sequence of multibyte characters to corresponding sequence of wide characters
mbtowc、_mbtowc_lmbtowc, _mbtowc_l 将多字节字符转换为对应的宽字符Convert multibyte character to corresponding wide character
strtod、_strtod_l、wcstod、_wcstod_lstrtod, _strtod_l, wcstod, _wcstod_l 将字符串转换为双精度浮点型。Convert string to double
strtol、wcstol、_strtol_l、_wcstol_lstrtol, wcstol, _strtol_l, _wcstol_l 将字符串转换为长整型整数Convert string to long integer
strtoul、_strtoul_l、wcstoul、_wcstoul_lstrtoul, _strtoul_l, wcstoul, _wcstoul_l 将字符串转换为无符号长整型整数Convert string to unsigned long integer
strxfrm、wcsxfrm、_strxfrm_l、_wcsxfrm_lstrxfrm, wcsxfrm, _strxfrm_l, _wcsxfrm_l 根据特定于区域设置的信息将字符串转换为排序格式Transform string into collated form based on locale-specific information
toascii、__toasciitoascii, __toascii 将字符转换为 ASCII 代码Convert character to ASCII code
tolower、_tolower、towlower、_tolower_l、_towlower_l_mbctolower、_mbctolower_l、_mbctoupper、_mbctoupper_ltolower, _tolower, towlower, _tolower_l, _towlower_l, _mbctolower, _mbctolower_l, _mbctoupper, _mbctoupper_l 测试字符,并且如果当前为大写形式,将其转换为小写形式Test character and convert to lowercase if currently uppercase
tolower、_tolower、towlower、_tolower_l、_towlower_ltolower, _tolower, towlower, _tolower_l, _towlower_l 无条件将字符转换为小写形式Convert character to lowercase unconditionally
toupper、_toupper、towupper、_toupper_l、_towupper_l_mbctolower、_mbctolower_l、_mbctoupper、_mbctoupper_ltoupper, _toupper, towupper, _toupper_l, _towupper_l, _mbctolower, _mbctolower_l, _mbctoupper, _mbctoupper_l 测试字符,并且如果当前为小写形式,将其转换为大写形式Test character and convert to uppercase if currently lowercase
toupper、_toupper、towupper、_toupper_l、_towupper_ltoupper, _toupper, towupper, _toupper_l, _towupper_l 无条件将字符转换为大写形式Convert character to uppercase unconditionally
wcstombs、_wcstombs_lwcstombs_s、_wcstombs_s_lwcstombs, _wcstombs_l, wcstombs_s, _wcstombs_s_l 将宽字符序列转换为相应的多字节字符序列Convert sequence of wide characters to corresponding sequence of multibyte characters
wctomb、_wctomb_lwctomb_s、_wctomb_s_lwctomb, _wctomb_l, wctomb_s, _wctomb_s_l 将宽字符转换为相应的多字节字符Convert wide character to corresponding multibyte character
_wtof、_wtof_l_wtof, _wtof_l 将宽字符字符串转换为双精度浮点型Convert wide-character string to a double
_wtoi、_wtoi_l_wtoi, _wtoi_l 将宽字符字符串转换为整型Convert wide-character string to int
_wtoi64、_wtoi64_l_wtoi64, _wtoi64_l 将宽字符字符串转换为 __int64 型或超长整型Convert wide-character string to __int64 or long long
_wtol、_wtol_l_wtol, _wtol_l 将宽字符字符串转换为长整型Convert wide-character string to long

请参阅See also

按类别分的通用 C 运行时例程Universal C runtime routines by category