CString Comparison Operators

BOOL operator ==( const CString& s1, const CString& s2 );

BOOL operator ==( const CString& s1, LPCTSTR s2 );

BOOL operator ==( LPCTSTR s1, const CString& s2 );

BOOL operator !=( const CString& s1, const CString& s2 );

BOOL operator !=( const CString& s1, LPCTSTR s2 );

BOOL operator !=( LPCTSTR s1, const CString& s2 );

BOOL operator <( const CString& s1, const CString& s2 );

BOOL operator <( const CString& s1, LPCTSTR s2 );

BOOL operator <( LPCTSTR s1, const CString& s2 );

BOOL operator >( const CString& s1, const CString& s2 );

BOOL operator >( const CString& s1, LPCTSTR s2 );

BOOL operator >( LPCTSTR s1, const CString& s2 );

BOOL operator <=( const CString& s1, const CString& s2 );

BOOL operator <=( const CString& s1, LPCTSTR s2 );

BOOL operator <=( LPCTSTR s1, const CString& s2 );

BOOL operator >=( const CString& s1, const CString& s2 );

BOOL operator >=( const CString& s1, LPCTSTR s2 );

BOOL operator >=( LPCTSTR s1, const CString& s2 );

Return Value

Nonzero if the strings meet the comparison condition; otherwise 0.

Parameters

s1, s2

CString objects to compare.

Remarks

These comparison operators compare two strings. The operators are a convenient substitute for the case-sensitive Compare member function.

Example

The following example demonstrates the use of CString Comparison Operators.

// example for CString Comparison Operators
CString s1( "abc" );
CString s2( "abd" );
ASSERT( s1 < s2 ); // Operator is overloaded for both.
ASSERT( "ABC" < s1 ); // CString and char*
ASSERT( s2 > "abe" );

CString OverviewClass MembersHierarchy Chart