_stricmp
功能:用于比较两个字符串,不区分大小写,根据比较结果返回整数。
用法:基本形式为_stricmp(str1,str2),若str1=str2,则返回零;若str1<str2,则返回负数;若str1>str2,则返回正数。
#include <stdio.h>
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;
}
}