CStringT::CollateNoCase

使用一般文本功能 _tcscoll,比较两个字符串。

int CollateNoCase(
   PCXSTR psz
) const throw();

参数

  • psz
    用于比较的另一个字符串。

返回值

如果字符串相同(忽略大小写)则为 0,如果 CStringT 对象小于 psz 则 < 0(忽略大小写),如果 CStringT 对象大于 psz 则 > 0(忽略大小写)。

备注

一般文本功能 _tcscoll,在TCHAR.H定义,映射到 stricollwcsicoll_mbsicoll,具体取决于在编译时定义的字符集。 每个功能是基于当前正在使用的代码页执行一个字符串的不区分大小写的比较。 有关更多信息,请参见 strcoll, wcscoll, _mbscoll, _strcoll_l, _wcscoll_l, _mbscoll_l

示例

// typedef CStringT<TCHAR, StrTraitATL<TCHAR, ChTraitsCRT<TCHAR>>> CAtlString;

CAtlString str1 = _T("Co-Op");
CAtlString str2 = _T("con");

int n;

// Collation uses language rules, such as ignoring dashes.
// NoCase version ignores case.
n = str1.CollateNoCase(str2);
ASSERT(n < 0);

// Comparison is a strict ASCII comparison with no language rules
// but still ignores case in NoCase version.
n = str1.CompareNoCase(str2);
ASSERT(n < 0);   

要求

Header: cstringt.h

请参见

参考

CStringT选件类