Compares two strings using the generic-text function _tcscoll.

int CollateNoCase(
   PCXSTR psz
) const throw();


  • psz
    The other string used for comparison.

Return Value

Zero if the strings are identical (ignoring case), < 0 if this CStringT object is less than psz (ignoring case), or > 0 if this CStringT object is greater than psz (ignoring case).


The generic-text function _tcscoll, which is defined in TCHAR.H, maps to either stricoll, wcsicoll, or _mbsicoll, depending on the character set that is defined at compile time. Each function performs a case-insensitive comparison of the strings, according to the code page currently in use. For more information, see 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

See Also


CStringT Class

Other Resources

CStringT Members