字符串比较
比较两个字符串指针:如果两个字符串相等,返回0
- strcmp(区分大小写) //多字节
- stricmp(不区分大小写) //多字节
- wcscmp(区分大小写) //宽字节
- wcsicmp(不区分大小写) //宽字节
- _tcscmp();(区分大小写) //多字节宽字节皆可
- _tcsicmp();(不区分大小写) //多字节宽字节皆可
- CString::Compare();(区分大小写)
- CString::CompareNoCase();(不区分大小写)
int wcscmp(
const wchar_t *string1,
const wchar_t *string2
);
int wcsicmp(
const wchar_t * _Str1,
const wchar_t * _Str2
);
字符串长度
- strlen(); //获取多字节字符串长度,不包含 ‘/0’。
- wcslen(); //获取宽字节字符串长度,不包含 ‘/0’。
- _tcslen() //获取宽字节和多字节字符串长度,不包含 ‘/0’。
- CString::GetLength();
size_t wcslen(
const wchar_t *str
);
字符串拷贝
- strcpy(); //多字节字符串拷贝
- wcscpy(); //宽字节字符串拷贝
- _tcscpy(); //两者皆可字符串拷贝
- CString::operator =
wchar_t *wcscpy(
wchar_t *strDestination,
const wchar_t *strSource
);
字符串拼接
- strcat(); //多字节字符串拼接
- wcscat(); //宽字节字符串拼接
- _tcscat(); //两者皆可字符串拼接
- CString::operator +=
wchar_t *wcscat(
wchar_t *strDestination,
const wchar_t *strSource
);
字符串转换
USES_CONVERSION;//定义转换宏
T2A:wchar_t->char
A2T:char->wchar_t