diff --git a/String.cpp b/String.cpp index c0b49368..da9c67e3 100644 --- a/String.cpp +++ b/String.cpp @@ -172,7 +172,10 @@ inline unsigned char* CString::strnchr(const unsigned char* src, unsigned char c return NULL; } -int CString::CaseCmp(const CString& s) const { +int CString::CaseCmp(const CString& s, u_long uLen ) const { + if( uLen != CString::npos ) { + return strncasecmp(c_str(), s.c_str(), uLen); + } return strcasecmp(c_str(), s.c_str()); } diff --git a/String.h b/String.h index 9cbad147..2ed4b928 100644 --- a/String.h +++ b/String.h @@ -79,7 +79,7 @@ public: virtual ~CString() {} 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) const; + int CaseCmp(const CString& s, u_long uLen = CString::npos ) const; int StrCmp(const CString& s) const; static bool WildCmp(const CString& sWild, const CString& sString); bool WildCmp(const CString& sWild) const;