老大下次问之前, 自己去看看msdn.// example for CString::CompareNoCase CString s1( "abc" ); CString s2( "ABD" ); ASSERT( s1.CompareNoCase( s2 ) == -1 ); // Compare with a CString. ASSERT( s1.Compare( _T("ABE" ) ) == -1 ); // Compare with LPTSTR string.
Compare Compares two strings (case sensitive). CompareNoCase Compares two strings (case insensitive).
The lstrcmp function compares two character strings. The comparison is case sensitive. int lstrcmp( LPCTSTR lpString1, // pointer to first string LPCTSTR lpString2 // pointer to second string );
lstrcmpi The lstrcmpi function compares two character strings. The comparison is not case sensitive. int lstrcmpi( LPCTSTR lpString1, // pointer to first string LPCTSTR lpString2 // pointer to second string );
CString s1,s2; if(0==strcpy(s1,s2)) than MessageBox("","相等");
s1="aa";
s2="bb";
if(s1 == s2)
.....
else
....
CString s1( "abc" );
CString s2( "ABD" );
ASSERT( s1.CompareNoCase( s2 ) == -1 ); // Compare with a CString.
ASSERT( s1.Compare( _T("ABE" ) ) == -1 ); // Compare with LPTSTR string.
CompareNoCase Compares two strings (case insensitive).
LPCTSTR lpString1, // pointer to first string
LPCTSTR lpString2 // pointer to second string
);
lstrcmpi
The lstrcmpi function compares two character strings. The comparison is not case sensitive. int lstrcmpi(
LPCTSTR lpString1, // pointer to first string
LPCTSTR lpString2 // pointer to second string
);
if(0==strcpy(s1,s2)) than MessageBox("","相等");
CString::Compare
CString::CompareNoCase
strcmp
strncmp
stricmp
strnicmp