aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/str.cpp5
-rw-r--r--common/str.h4
2 files changed, 7 insertions, 2 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 31cbb7cd22..e5272bd133 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -211,6 +211,11 @@ bool String::hasSuffix(const char *x) const {
return *x == 0;
}
+bool String::contains(const char *x) const {
+ assert(x != 0);
+ return strstr(c_str(), x) != NULL;
+}
+
void String::deleteLastChar() {
deleteChar(_len - 1);
}
diff --git a/common/str.h b/common/str.h
index 16122b579f..9fbb6734f5 100644
--- a/common/str.h
+++ b/common/str.h
@@ -125,10 +125,10 @@ public:
int compareTo(const char *x) const; // strcmp clone
int compareToIgnoreCase(const char *x) const; // stricmp clone
-
-
bool hasSuffix(const char *x) const;
bool hasPrefix(const char *x) const;
+
+ bool contains(const char *x) const;
inline const char *c_str() const { return _str; }
inline uint size() const { return _len; }