# cStringTokenizer Class Reference
[Utility classes]

`#include <cstrtokenizer.h>`

List of all members.

## Detailed Description

String tokenizer class, based on strtok().

Example usage:

     const char *str = "34 42 13 46 72 41"; // input
     std::vector<int> numbers;  // array to hold result

     cStringTokenizer tokenizer(str);
     const char *token;
     while ((token = tokenizer.nextToken())!=NULL)
         numbers.push_back(atoi(token));

## Public Member Functions

| cStringTokenizer (const char *str, const char *delimiters=" ")
| ~cStringTokenizer ()
void | setDelimiter (const char *s)
bool | hasMoreTokens ()
const char * | nextToken ()
std::vector< std::string > | asVector ()

## Constructor & Destructor Documentation

cStringTokenizer::cStringTokenizer | ( | const char * | str,
|  | const char * | delimiters = `" "`
| ) |

| Constructor. The class will make its own copy of the input string and of the delimiters string.

cStringTokenizer::~cStringTokenizer | ( |  | ) |

| Destructor.

## Member Function Documentation

std::vector<std::string> cStringTokenizer::asVector | ( |  | ) |

| Utility function: tokenizes the full input string at once, and returns the tokens in a string vector.

bool cStringTokenizer::hasMoreTokens | ( |  | ) | `[inline]`

| Returns true if there're more tokens (i.e. the next nextToken() call won't return NULL).

const char* cStringTokenizer::nextToken | ( |  | ) |

| Returns the next token. The returned pointers will stay valid as long as the tokenizer object exists. If there're no more tokens, a NULL pointer will be returned.

void cStringTokenizer::setDelimiter | ( | const char * | s | ) |

| Change delimiters. This allows for switching delimiters during tokenization.

The documentation for this class was generated from the following file:

- cstrtokenizer.h