This documentation is archived and is not being maintained.

CStringT::CompareNoCase 

Compares two strings (case insensitive).


int CompareNoCase(
   PCXSTR psz
) const throw();

Parameters

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 _tcsicmp, which is defined in TCHAR.H, maps to either _stricmp, _wcsicmp or _mbsicmp, depending on the character set that is defined at compile time. Each function performs a case-insensitive comparison of the strings. The comparison depends on the LC_CTYPE aspect of the locale but not LC_COLLATE. For more information, see _stricmp, _wcsicmp, _mbsicmp, _stricmp_l, _wcsicmp_l, _mbsicmp_l.

//typedef CStringT< TCHAR, StrTraitATL< TCHAR > > CAtlString;

CAtlString s1( "abc" );
CAtlString s2( "ABD" );
_ASSERT( s1.CompareNoCase( s2 ) < 0 ); // Compare with a CAtlString.
_ASSERT( s1.CompareNoCase( "ABE" ) < 0 ); // Compare with LPTSTR string.
Show: