Visual Studio 6.0


int CompareNoCase( 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).


Compares this CString object with another string using the generic-text function _tcsicmp. The generic-text function _tcsicmp, which is defined in TCHAR.H, maps to either _stricmp, _wcsicmp, _mbsicmp depending on the character set that is defined at compile time. Each of these functions performs a case-insensitive comparison of the strings, and is not affected by locale. For more information, see https://msdn.microsoft.com/en-us/library/k59z8dwe(v=vs.60).aspx in the Run-Time Library Reference.


The following example demonstrates the use of CString::CompareNoCase.

// example for CString::CompareNoCase
CString s1( "abc" );
CString s2( "ABD" );
ASSERT( s1.CompareNoCase( s2 ) == -1 ); // Compare with a CString.
ASSERT( s1.Compare( "ABE" ) == -1 ); // Compare with LPTSTR string.

CString OverviewClass MembersHierarchy Chart

See Also   CString::Compare, CString::Collate, CString::CollateNoCase

© 2015 Microsoft