diff options
| author | Max Horn | 2007-04-15 18:27:10 +0000 |
|---|---|---|
| committer | Max Horn | 2007-04-15 18:27:10 +0000 |
| commit | aecd100f93cf0d475092acefe37bff8c5d55b881 (patch) | |
| tree | bdf96fc808c4014c7369f32a3b72abe1c5c02e27 /common | |
| parent | 35b19cdcc8499cf3b73e49a864eea976cc9525fe (diff) | |
| download | scummvm-rg350-aecd100f93cf0d475092acefe37bff8c5d55b881.tar.gz scummvm-rg350-aecd100f93cf0d475092acefe37bff8c5d55b881.tar.bz2 scummvm-rg350-aecd100f93cf0d475092acefe37bff8c5d55b881.zip | |
Added Common::String::contains() method
svn-id: r26514
Diffstat (limited to 'common')
| -rw-r--r-- | common/str.cpp | 5 | ||||
| -rw-r--r-- | common/str.h | 4 |
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; } |
