char与wchar_t函数对照表  

5 篇文章 0 订阅
 
#include <ctype.h>
#include <string.h>
把多字符把转换成宽字符
_CRTIMP size_t    __cdecl mbstowcs(wchar_t *, const wchar* ,size_t);
将宽字符转换成多字符
_CRTIMP size_t    __cdecl wcstombs(char *mbstr, const wchar_t *wcstr, size_t count);
计算字符数
size_t __cdecl strlen(const char *);
_INTRIMP size_t    __cdecl wcslen(const wchar_t *); 
比较字符串
int    __cdecl strcmp(const char *, const char *);
_INTRIMP int  __cdecl wcscmp(const wchar_t *, const wchar_t *);
拼接字符串
char * __cdecl strcat(char *, const char *);
_INTRIMP wchar_t * __cdecl wcscat(wchar_t *, const wchar_t *);
拷贝字符串
char * __cdecl strcpy(char *, const char *);
_INTRIMP wchar_t * __cdecl wcscpy(wchar_t *, const wchar_t *);
查找字符 返回地址
_CRTIMP char * __cdecl strchr(const char *, char);
_CRTIMP wchar_t * __cdecl wcschr(const wchar_t *, wchar_t);
查找字符 返回位置
_CRTIMP size_t __cdecl strcspn(const char *, const char *);
_CRTIMP size_t    __cdecl wcscspn(const wchar_t *, const wchar_t *);
查找完全匹配的子字符串
_CRTIMP char * __cdecl strstr(const char *, const char *);
_CRTIMP wchar_t * __cdecl wcsstr(const wchar_t *, const wchar_t *);
按位置拼接字符串  const char* 前n的字符
_CRTIMP char * __cdecl strncat(char *, const char *, size_t);
_CRTIMP wchar_t * __cdecl wcsncat(wchar_t *, const wchar_t *, size_t);
分割字符串
_CRTIMP char * __cdecl strtok(char *, const char *);
_CRTIMP wchar_t * __cdecl wcstok(wchar_t *, const wchar_t *);
拷贝字符串 const char* 前n的字符
_CRTIMP char * __cdecl strncpy(char *, const char *, size_t);
_CRTIMP wchar_t * __cdecl wcsncpy(wchar_t *, const wchar_t *, size_t);
比较字符串  前n个字符
_CRTIMP int    __cdecl strncmp(const char *, const char *, size_t);
_CRTIMP int       __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t);
比较字符串,不区分字母的大小写
_CRTIMP int     __cdecl _stricmp(const char *, const char *);
_CRTIMP int       __cdecl _wcsicmp(const wchar_t *, const wchar_t *);
比较字符串的前n个字符串字典序的大小,不区分字母大小写
_CRTIMP int     __cdecl _strnicmp(const char *, const char *, size_t);
_CRTIMP int       __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t);
检验参数1中的字符,当被检验字符在参数2中也包含时,返回该字符位置,空字符不包括在内。
_CRTIMP char * __cdecl strpbrk(const char *, const char *);
_CRTIMP wchar_t * __cdecl wcspbrk(const wchar_t *, const wchar_t *);
查找一个字符在另一个字符串中末次出现的位置
_CRTIMP char * __cdecl strrchr(const char *, char);
_CRTIMP wchar_t * __cdecl wcsrchr(const wchar_t *, wchar_t);
从参数1开头计算连续字符,如字符完全是参数2中的字符。返回开头连续包含的字符数目。
_CRTIMP size_t __cdecl strspn(const char *, const char *);
_CRTIMP size_t    __cdecl wcsspn(const wchar_t *, const wchar_t *);
复制字符串 使用完后需要free()释放内存,可直接复制CString中的字符串
_CRTIMP char * __cdecl _strdup(const char *);
_CRTIMP wchar_t * __cdecl _wcsdup(const wchar_t *);
将一个串中的前N个字符都设为指定字符
_CRTIMP char * __cdecl _strnset(char *, char, size_t);
_CRTIMP wchar_t * __cdecl _wcsnset(wchar_t *, wchar_t, size_t);
把字符串的所有字符的顺序颠倒过来(不包括空字符NULL)。
_CRTIMP char * __cdecl _strrev(char *);
_CRTIMP wchar_t * __cdecl _wcsrev(wchar_t *);
将一个串中的所有字符都设为指定字符,不建议使用,该函数不会检查‘\0',容易导致内存错误
char * __cdecl _strset(char *, int);
_CRTIMP wchar_t * __cdecl _wcsset(wchar_t *, wchar_t);
将字符串转换为小写形式
_CRTIMP char * __cdecl _strlwr(char *);
_CRTIMP wchar_t * __cdecl _wcslwr(wchar_t *);
将字符串转换为大写形式
_CRTIMP char * __cdecl _strupr(char *);
_CRTIMP wchar_t * __cdecl _wcsupr(wchar_t *);
把字符转换成小写字母,非字母字符不做出处理
_C
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值