eckit::Tokenizer class

Public static functions

static auto split_at(const std::string& s, char separator) -> std::vector<std::string>

Constructors, destructors, conversion operators

Tokenizer(char, bool keepEmpty = false)
Tokenizer(const std::string&, bool keepEmpty = false)
~Tokenizer()

Public functions

void operator()(const std::string&, std::vector<std::string>&) const
void operator()(std::istream&, std::vector<std::string>&) const
void operator()(const std::string&, std::set<std::string>&) const
void operator()(std::istream&, std::set<std::string>&) const
auto tokenize(const std::string&) const -> std::vector<std::string>
auto tokenize(std::istream&) const -> std::vector<std::string>

Friends

auto operator<<(std::ostream& s, const Tokenizer& p) -> std::ostream&

Function documentation

static std::vector<std::string> eckit::Tokenizer::split_at(const std::string& s, char separator)

Splits the given the string on the first instance of the separator.

The result is the set of separated tokens:

  • if the separator is not found, containing 1 token: [begin, end]
  • if the separator is found, containing 2 tokens: [begin, separator[, ]separator, end]