#include <regexp.h>
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));
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 () |
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... | |
| 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] |
| const_iterator wibble::Splitter::end | ( | ) | [inline] |
References wibble::Regexp::re.
1.5.6