The following function compares two strings without any case sensitivity:
bool CompareWithoutCaseSensitivity(string s1, string s2)
{
bool r = false;
string tmp = "", tmp2 = "";
int i;
for (i = 0; i < s1.length(); i++)
{
tmp = tmp + (char)toupper(s1.at(i));
}
for (i = 0; i < s2.length(); i++)
{
tmp2 = tmp2 + (char)toupper(s2.at(i));
}
return (tmp == tmp2);
}
You can improve this code if you find any defects. I wrote it just now and I can't assure you this is the best method.