55 string::size_type index = s.find_first_not_of(delimiters, 0);
56 while (index != s.npos)
58 string::size_type newIndex = s.find_first_of(delimiters, index);
59 if (newIndex != s.npos)
61 tokens_.push_back(s.substr(index, newIndex - index));
62 if (!allowEmptyTokens)
63 index = s.find_first_not_of(delimiters, newIndex);
66 splits_.push_back(s.substr(newIndex, index - newIndex));
70 tokens_.push_back(s.substr(index));
77 string::size_type index = 0;
78 while (index != s.npos)
80 string::size_type newIndex = s.find(delimiters, index);
81 if (newIndex != s.npos)
83 tokens_.push_back(s.substr(index, newIndex - index));
84 if (!allowEmptyTokens)
86 index = newIndex + delimiters.size();
87 while (index != string::npos && s.substr(index, delimiters.size()) == delimiters)
88 index += delimiters.size();
91 index = newIndex + delimiters.size();
92 splits_.push_back(s.substr(newIndex, index - newIndex));
96 tokens_.push_back(s.substr(index));
size_t numberOfRemainingTokens() const
Tell how many tokens are available.
size_t currentPosition_
the current position in the token list.
std::string unparseRemainingTokens() const
std::deque< std::string > splits_
std::deque< std::string > tokens_
Where the tokens are stored.
void removeEmptyTokens()
remove all empty token from the current position.