diff --git a/ZNCString.cpp b/ZNCString.cpp index fa7f9169..353b9169 100644 --- a/ZNCString.cpp +++ b/ZNCString.cpp @@ -186,6 +186,13 @@ int CString::StrCmp(const CString& s, unsigned long uLen) const { return strcmp(c_str(), s.c_str()); } +bool CString::Equals(const CString& s, bool bCaseSensitive, unsigned long uLen) const { + if (bCaseSensitive) + return (StrCmp(s, uLen) == 0); + else + return (CaseCmp(s, uLen) == 0); +} + bool CString::WildCmp(const CString& sWild, const CString& sString) { // Written by Jack Handy - jakkhandy@hotmail.com const char *wild = sWild.c_str(), *CString = sString.c_str(); diff --git a/ZNCString.h b/ZNCString.h index 48e8f57f..7b693fea 100644 --- a/ZNCString.h +++ b/ZNCString.h @@ -82,6 +82,7 @@ public: inline unsigned char* strnchr(const unsigned char* src, unsigned char c, unsigned int iMaxBytes, unsigned char* pFill = NULL, unsigned int* piCount = NULL) const; int CaseCmp(const CString& s, unsigned long uLen = CString::npos) const; int StrCmp(const CString& s, unsigned long uLen = CString::npos) const; + bool Equals(const CString& s, bool bCaseSensitive = false, unsigned long uLen = CString::npos) const; static bool WildCmp(const CString& sWild, const CString& sString); bool WildCmp(const CString& sWild) const;