CString::CollateNoCase

int CollateNoCase( LPCTSTR lpsz ) const;

Return Value

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

Parameters

lpsz

A pointer to the other string used for comparison.

Remarks

Compares this CString object with another string using the generic-text function _tcscoll. 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 of these functions performs a case-insensitive comparison of the strings, according to the code page currently in use.

Example

CString str1 = _T("Co-Op");
CString 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);

CString OverviewClass MembersHierarchy Chart

See Also   CString::Collate, CString::CompareNoCase, CString::Compare