Compares two strings (case sensitive).
int Compare( PCXSTR psz ) const throw();
- The other string used for comparison.
Zero if the strings are identical, < 0 if this CStringT object is less than psz, or > 0 if this CStringT object is greater than psz.
The generic-text function _tcscmp, which is defined in TCHAR.H, maps to either strcmp, wcscmp, or _mbscmp depending on the character set that is defined at compile time. Each of these functions performs a case-sensitive comparison of the strings and is not affected by locale. For more information, see strcmp, wcscmp, _mbscmp in the Run-Time Library Reference.
The following example demonstrates the use of CStringT::Compare.
//typedef CStringT< TCHAR, StrTraitATL< TCHAR > > CAtlString; CAtlString s1( "abc" ); CAtlString s2( "abd" ); _ASSERT( s1.Compare( s2 ) < 0 ); // Compare with another CAtlString. _ASSERT( s1.Compare( "abe" ) < 0 ); // Compare with LPTSTR string.