28 #if defined(HAVE_STRCASECMP) || defined (HAVE_STRNCASECMP)
32 #if defined(HAVE_STRICMP) || defined (HAVE_STRNICMP)
43 inline bool casecompare(
char c1,
char c2) {
return (tolower(c1) == tolower(c2)); }
48 inline bool equal(
const std::string& s1,
const std::string& s2)
50 return s1.size() == s2.size()
51 && std::equal(s1.begin(), s1.end(), s2.begin(), casecompare);
57 inline bool equal(
const char* s1,
const char* s2)
60 #if defined(HAVE_STRCASECMP)
61 return strcasecmp(s1, s2) == 0;
62 #elif defined(HAVE_STRICMP)
63 return stricmp(s1, s2) == 0;
68 if (s1 == 0 || s2 == 0)
71 while ((*s1 !=
'\0') || (*s2 !=
'\0'))
73 if (!casecompare(*s1, *s2))
86 inline bool equal(
const char* s1,
const char* s2,
size_t n)
89 #if defined(HAVE_STRNCASECMP)
90 return strncasecmp(s1, s2, n) == 0;
91 #elif defined(HAVE_STRNICMP)
92 return strnicmp(s1, s2, n) == 0;
94 if (s1 == s2 || n == 0)
97 if (s1 == 0 || s2 == 0)
100 while (n-- && ((*s1 !=
'\0') || (*s2 !=
'\0')))
102 if (!casecompare(*s1, *s2))
Definition: stringutils.h:41