Split a string using a regular expression to match the token separators. More...
#include <regexp.h>
Classes | |
class | const_iterator |
Warning: the various iterators reuse the Regexps and therefore only one iteration of a Splitter can be done at a given time. More... | |
Public Member Functions | |
Splitter (const std::string &re, int flags) | |
Create a splitter that uses the given regular expression to find tokens. | |
const_iterator | begin (const std::string &str) |
Split the string and iterate the resulting tokens. | |
const_iterator | end () |
Split a string using a regular expression to match the token separators.
This does a similar work to the split functions of perl, python and ruby.
Example code:
utils::Splitter splitter("[ \t]*,[ \t]*", REG_EXTENDED);
vector<string> split;
std::copy(splitter.begin(myString), splitter.end(), back_inserter(split));
wibble::Splitter::Splitter | ( | const std::string & | re, | |
int | flags | |||
) | [inline] |
Create a splitter that uses the given regular expression to find tokens.
const_iterator wibble::Splitter::begin | ( | const std::string & | str | ) | [inline] |
Split the string and iterate the resulting tokens.
References wibble::Regexp::re.
const_iterator wibble::Splitter::end | ( | ) | [inline] |
References wibble::Regexp::re.