Add CString::Contains() for convenience

This is more convenient and readable than comparing Find() to npos,
which is a common task:

$ git grep "find(" | grep "npos" | wc -l
49
This commit is contained in:
J-P Nurmi
2014-09-29 16:27:24 +02:00
parent 5507e9a290
commit e20ac1a31e
3 changed files with 25 additions and 0 deletions
+4
View File
@@ -1116,6 +1116,10 @@ bool CString::EndsWith(const CString& sSuffix, CaseSensitivity cs) const {
return Right(sSuffix.length()).Equals(sSuffix, cs);
}
bool CString::Contains(const CString& s, CaseSensitivity cs) const {
return Find(s, cs) != npos;
}
CString CString::TrimPrefix_n(const CString& sPrefix) const {
CString sRet = *this;