CString::Compare

This method compares this CString object with another string using the Windows CE lstrcmp function.

  int Compare(
LPCTSTR 
  lpsz
  )
const;
   

Parameters

  • lpsz
    Specifies the other string used for comparison.

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.

Example

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

  // example for CString::Compare
CString s1("abc");
CString s2("abd");
ASSERT(s1.Compare(s2) == -1); // Compare with another CString.
ASSERT(s1.Compare(_T("abe")) == -1); // Compare with LPTSTR string.

Requirements

  Windows CE versions: 1.0 and later
  Header file: Declared in Afx.h
  Platform: H/PC Pro, Palm-size PC, Pocket PC

See Also

CString::CompareNoCase