summaryrefslogtreecommitdiff
path: root/common/str.cpp
diff options
context:
space:
mode:
authorleo2003-07-30 16:33:40 +0000
committerleo2003-07-30 16:33:40 +0000
commit30a0a3fa7fa13af938d41b9a4118dfbcc7273315 (patch)
tree19d313e9cfcdb90c826d10ee8be101c8ef7d42c8 /common/str.cpp
parentfd2913d40bcd329236025a84c0509d897b8ee2e0 (diff)
Added new string comparison function.
git-svn-id: http://svn.leocad.org/trunk@341 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/str.cpp')
-rw-r--r--common/str.cpp20
1 files changed, 20 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)