mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 08:24:08 +01:00
ircd: Add tokens_after() util.
This commit is contained in:
parent
a0e7002dde
commit
8ef0b50131
2 changed files with 15 additions and 0 deletions
|
@ -130,6 +130,7 @@ size_t tokens_count(const string_view &str, const char *const &sep);
|
|||
string_view token(const string_view &str, const char *const &sep, const size_t &at);
|
||||
string_view token_last(const string_view &str, const char *const &sep);
|
||||
string_view token_first(const string_view &str, const char *const &sep);
|
||||
string_view tokens_after(const string_view &str, const char *const &sep, const size_t &at);
|
||||
|
||||
class params
|
||||
{
|
||||
|
|
|
@ -23,6 +23,20 @@
|
|||
#include <RB_INC_BOOST_TOKENIZER_HPP
|
||||
#include <RB_INC_BOOST_LEXICAL_CAST_HPP
|
||||
|
||||
ircd::string_view
|
||||
ircd::tokens_after(const string_view &str,
|
||||
const char *const &sep,
|
||||
const size_t &i)
|
||||
try
|
||||
{
|
||||
const auto t(token(str, sep, i + 1));
|
||||
return { t.data(), str.data() + str.size() };
|
||||
}
|
||||
catch(const std::out_of_range &e)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::token_first(const string_view &str,
|
||||
const char *const &sep)
|
||||
|
|
Loading…
Reference in a new issue