0

What are the equivalents of the functions strcmpi(), strncmp() and strncmpi() for C++ style strings?

Please do not suggest using things like strcmpi(str1.c_str, str2.c_str) etc.

Thanks in advance for any help.

1 Answers1

0

If you're using Boost you could use this to do case-insensitive comparation:

#include <boost/algorithm/string.hpp>

std::string str1 = "hello, world!";
std::string str2 = "hELLO, World!";

if (boost::iequals(str1, str2))
{
    // Strings are identical
}
djf
  • 6,592
  • 6
  • 44
  • 62