28 #if defined(HAVE_STRCASECMP) || defined (HAVE_STRNCASECMP) 32 #if defined(HAVE_STRICMP) || defined (HAVE_STRNICMP) 46 inline bool casecompare(
char c1,
char c2) {
return (tolower(c1) == tolower(c2)); }
53 inline bool equal(
const std::string& s1,
const std::string& s2)
55 return s1.size() == s2.size()
56 && std::equal(s1.begin(), s1.end(), s2.begin(), casecompare);
64 inline bool equal(
const char* s1,
const char* s2)
67 #if defined(HAVE_STRCASECMP) 68 return strcasecmp(s1, s2) == 0;
69 #elif defined(HAVE_STRICMP) 70 return stricmp(s1, s2) == 0;
75 if (s1 == 0 || s2 == 0)
78 while ((*s1 !=
'\0') || (*s2 !=
'\0'))
80 if (!casecompare(*s1, *s2))
95 inline bool equal(
const char* s1,
const char* s2,
size_t n)
98 #if defined(HAVE_STRNCASECMP) 99 return strncasecmp(s1, s2, n) == 0;
100 #elif defined(HAVE_STRNICMP) 101 return strnicmp(s1, s2, n) == 0;
103 if (s1 == s2 || n == 0)
106 if (s1 == 0 || s2 == 0)
109 while (n-- && ((*s1 !=
'\0') || (*s2 !=
'\0')))
111 if (!casecompare(*s1, *s2))
Definition: stringutils.h:41