【C++】字符串不区分大小写比较
#include <>
using namespace std;
void main() {
string str1 = "STR";
string str2 = "str";
if (0 == _stricmp(str1.c_str(), str2.c_str())) {
cout << "str1 = str2" << endl;
}
else (0 > _stricmp(str1.c_str(), str2.c_str())) {
cout << "str1 < str2" << endl;
}
else (0 < _stricmp(str1.c_str(), str2.c_str())) {
cout << "str1 > str2" << endl;
}
}