Compartilhar via


CStringT::CompareNoCase

Compares two strings (case insensitive).

int CompareNoCase(
   PCXSTR psz
) const throw();

Parameters

  • psz
    The other string used for comparison.

Return Value

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).

Remarks

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.

Example

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

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

Requirements

Header: cstringt.h

See Also

Reference

CStringT Class