Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CStringT::CollateNoCase

Compares two strings using the generic-text function _tcscoll.

int CollateNoCase(
   PCXSTR psz
) const throw();
psz

The other string used for comparison.

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.