mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 08:24:08 +01:00
ircd: Add startswith_any() complement to endswith_any().
This commit is contained in:
parent
4a6b3f5fcc
commit
dd0de82e16
1 changed files with 13 additions and 0 deletions
|
@ -206,6 +206,7 @@ namespace ircd
|
|||
template<class It> bool endswith_any(const string_view &str, const It &begin, const It &end);
|
||||
bool startswith(const string_view &str, const string_view &val);
|
||||
bool startswith(const string_view &str, const char &val);
|
||||
template<class It> bool startswith_any(const string_view &str, const It &begin, const It &end);
|
||||
bool surrounds(const string_view &str, const string_view &val);
|
||||
bool surrounds(const string_view &str, const char &val);
|
||||
string_view unquote(string_view str);
|
||||
|
@ -250,6 +251,18 @@ ircd::surrounds(const string_view &str,
|
|||
return startswith(str, val) && endswith(str, val);
|
||||
}
|
||||
|
||||
template<class It>
|
||||
bool
|
||||
ircd::startswith_any(const string_view &str,
|
||||
const It &begin,
|
||||
const It &end)
|
||||
{
|
||||
return std::any_of(begin, end, [&str](const auto &val)
|
||||
{
|
||||
return startswith(str, val);
|
||||
});
|
||||
}
|
||||
|
||||
inline bool
|
||||
ircd::startswith(const string_view &str,
|
||||
const char &val)
|
||||
|
|
Loading…
Reference in a new issue