From 6b82aec7f45d67267d8521dc64a6e421de93f150 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 30 Mar 2001 04:23:10 +0000 Subject: Added a contains method so it is easy to see if a string contains a particular character. --- include/SString.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/SString.h') diff --git a/include/SString.h b/include/SString.h index c34d7d836..ea2eec993 100644 --- a/include/SString.h +++ b/include/SString.h @@ -170,6 +170,12 @@ public: bool operator!=(const char *sother) const { return !operator==(sother); } + bool contains(char ch) { + if (s && *s) + return strchr(s, ch) != 0; + else + return false; + } const char *c_str() const { if (s) return s; -- cgit v1.2.3