I have seen this question and mine is very similar to it, but it is different, so please do not mark it as duplicate.
My question is: How do I get the empty fields from a string?
I have a string like std::string s = "This.is..a.test";
and I want to get the fields <This> <is> <> <a> <test>
.
I have tried also
typedef boost::char_separator<char> ChSep;
typedef boost::tokenizer<ChSep> TknChSep;
ChSep sep(".", ".", boost::keep_empty_tokens);
TknChSep tok(s, sep);
for (TknChSep::iterator beg = tok.begin(); beg != tok.end(); ++beg)
{
std::cout << "<" << *beg << "> ";
}
but I get <This> <.> <is> <.> <> <.> <a> <test>
.