add string char contains overload

v1
Brett 2023-10-14 18:35:11 -04:00
parent ce642a30b7
commit 4f4ed1918b
1 changed files with 7 additions and 0 deletions

View File

@ -89,6 +89,13 @@ namespace blt::string
return true; return true;
} }
static inline bool contains(const std::string& string, const char search)
{
std::ranges::any_of(string, [search](const char c) -> bool {
return c == search;
});
}
static inline bool contains(const std::string& string, const std::string& search) static inline bool contains(const std::string& string, const std::string& search)
{ {
if (search.length() > string.length()) if (search.length() > string.length())