#include <strtok.h>
Public Member Functions | |
StringTokenizer (const std::string &rStr, char cDelim= ',') | |
Constructor. | |
~StringTokenizer () | |
Destructor. | |
bool | HasMoreTokens () const |
Checks whether the tokenizer can provide more tokens. | |
std::string | GetNextToken () |
Returns the next token. | |
void | SetDelimiter (char cDelim) |
Sets a delimiter (separator) character. | |
char | GetDelimiter () const |
Returns the delimiter (separator) character. | |
void | Reset () |
Resets the tokenizer. |
This class implements a string tokenizer. It splits a string by a character to a number of elements (tokens) which are provided sequentially.
All operations are made on the original string itself. The implementation is not ready to handle any changes of the string.
The original string is left unchanged. All tokens are returned as newly created strings.
|
Constructor. Creates a ready-to-use tokenizer.
|
|
Destructor.
|
|
Returns the delimiter (separator) character.
|
|
Returns the next token.
|
|
Checks whether the tokenizer can provide more tokens.
|
|
Resets the tokenizer. Re-initializes tokenizing to the start of the string. |
|
Sets a delimiter (separator) character. The new delimiter has effect only to tokens returned later; the position in the string is not affected.
|