summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/str.cpp20
-rw-r--r--common/str.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp
index cb82ada..304cd88 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -194,6 +194,26 @@ int String::CompareNoCase (const char *string) const
return (((int)*ch) - ((int)*string));
}
+int String::CompareNoCase(const char *string, int count) const
+{
+ char c1, c2, *ch = m_pData;
+
+ while (*ch && *string && count)
+ {
+ c1 = tolower (*ch);
+ c2 = tolower (*string);
+
+ if (c1 != c2)
+ return (c1 - c2);
+
+ ch++;
+ string++;
+ count--;
+ }
+
+ return (((int)*ch) - ((int)*string));
+}
+
void String::MakeUpper ()
{
for (char *cp = m_pData; *cp; ++cp)
diff --git a/common/str.h b/common/str.h
index cc6d474..23e6f1a 100644
--- a/common/str.h
+++ b/common/str.h
@@ -43,6 +43,7 @@ class String
int Compare (const char *string) const
{ return strcmp (m_pData, string); }
int CompareNoCase (const char *string) const;
+ int CompareNoCase (const char *string, int count) const;
// simple sub-string extraction
String& Mid (int first, int count) const;