My question is similar to this, but I have two strings (as char *
) and the task is to replace strnicmp
function (avaible only for MS VC) with something like boost::iequals
.
Note strnicmp
is not stricmp
- it only compares first n characters.
Is there any solution simplier than this:
void foo(const char *s1, const char *s2)
{
...
std::string str1 = s1;
std::string str2 = s2;
int n = 7;
if (boost::iequals(str1.substr(0, n), str2)) {
...
}
}