I want to know
How to compare 2 CString?
is there something like strcmp(s1, s2)?
Thanks
This is a discussion on How to compare 2 CString within the C++ Programming forums, part of the General Programming Boards category; I want to know How to compare 2 CString? is there something like strcmp(s1, s2)? Thanks...
I want to know
How to compare 2 CString?
is there something like strcmp(s1, s2)?
Thanks
I get it
s1 == s2
so simple
CString objects support comparison through the == operator as well as the Compare and CompareNoCase member functions (which return 0 if the strings are equal).
Code:// example for CString == Operators CString s1( "abc" ); CString s2( "abc" ); if( s1 == s2 ) cout << "They are the same." << endl; else cout << "They are different." << endl;Code:// example for CString::Compare CString s1( "abc" ); CString s2( "abc" ); if( !s1.Compare( s2 ) ) cout << "They are the same." << endl; else cout << "They are different." << endl;Code:// example for CString::CompareNoCase CString s1( "abc" ); CString s2( "ABC" ); if( !s1.CompareNoCase( s2 ) ) cout << "They are the same." << endl; else cout << "They are different." << endl;
I used to be an adventurer like you... then I took an arrow to the knee.