Template Function mrpt::system::tokenize

Function Documentation

template<class OUT_CONTAINER>
void mrpt::system::tokenize(const std::string &inString, const std::string &inDelimiters, OUT_CONTAINER &outTokens, bool skipBlankTokens = true) noexcept

Tokenizes a string according to a set of delimiting characters. Example:

std::vector<std::string>    tokens;
tokenize(" - Pepe-Er  Muo"," -",tokens);

Will generate 3 tokens:

  • ”Pepe”

  • ”Er”

  • ”Muo”

Parameters:

skipBlankTokens[in] If true, consecutive “delimiters” will be considered one single delimiters. If false, a blank token will be returned between each pair of delimiters.

Template Parameters:

OUT_CONTAINER – Can be a std::vector or std::deque of std::string’s.