CString::Collate

int Collate( LPCTSTR lpsz ) const;

Return Value

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

Parameters

lpsz

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 strcoll, wcscoll, or _mbscoll depending on the character set that is defined at compile time. Each of these functions performs a case-sensitive comparison of the strings according to the code page currently in use. For more information, see strcat, wcscat, _mbscat in the Run-Time Library Reference.

Example

CString str1 = _T("co-op");
CString str2 = _T("con");

int n;

// collation uses language rules, such as ignoring dashes
n = str1.Collate(str2);
ASSERT(n > 0);

// comparison is a strict ASCII comparison with no language rules
n = str1.Compare(str2);
ASSERT(n < 0);

CString OverviewClass MembersHierarchy Chart

See Also   CString::Compare, CString::CompareNoCase