Compare
Perform a case-sensitive comparison of this string object with another string.
int Compare( LPCSTR lpsz )
Zero if the strings are identical, < 0 if this string object is less than lpsz, or > 0 if this string object is greater than lpsz.
EX1
void string_Compare_ex1() { string str("abc"); int nRet; nRet = str.Compare("abb"); out_int("This string is greater than \"abb\" : 1", nRet); // 1 nRet = str.Compare("abc"); out_int("The strings are identical : ", nRet); // 0 nRet = str.Compare("abz"); out_int("This string is less than \"abz\" : ", nRet); // -1 nRet = str.Compare("ABC"); out_int("This string is greater than \"ABC\" : ", nRet); // 1 nRet = str.Compare("ab"); out_int("This string is greater than \"ab\" : ", nRet); // 1 nRet = str.Compare("abcd"); out_int("This string is less than \"abcd\" : ", nRet); // -1 }
string::CompareNoCase
origin.h