| Version: 3.3.1

Classes | Macros | Enumerations | Functions
tokenzr.h File Reference

## Classes
class | wxStringTokenizer
| wxStringTokenizer helps you to break a string up into a number of tokens. More...

## Macros
#define | wxDEFAULT_DELIMITERS " \t\r\n"
| Default wxStringTokenizer delimiters are the usual white space characters. More...

## Enumerations
enum | wxStringTokenizerMode { wxTOKEN_INVALID = -1 , wxTOKEN_DEFAULT , wxTOKEN_RET_EMPTY , wxTOKEN_RET_EMPTY_ALL , wxTOKEN_RET_DELIMS , wxTOKEN_STRTOK }
| The behaviour of wxStringTokenizer is governed by the wxStringTokenizer::wxStringTokenizer() or wxStringTokenizer::SetString() with the parameter mode, which may be one of the following: More...

## Functions
wxArrayString | wxStringTokenize (const wxString &str, const wxString &delims=wxDEFAULT_DELIMITERS, wxStringTokenizerMode mode=wxTOKEN_DEFAULT)
| This is a convenience function wrapping wxStringTokenizer which simply returns all tokens found in the given str as an array. More...

## Macro Definition Documentation

## ◆ wxDEFAULT_DELIMITERS

#define wxDEFAULT_DELIMITERS " \t\r\n"

Default wxStringTokenizer delimiters are the usual white space characters.

## Enumeration Type Documentation

## ◆ wxStringTokenizerMode

enum wxStringTokenizerMode

The behaviour of wxStringTokenizer is governed by the wxStringTokenizer::wxStringTokenizer() or wxStringTokenizer::SetString() with the parameter mode, which may be one of the following:

Enumerator
wxTOKEN_INVALID | Invalid tokenizer mode.
wxTOKEN_DEFAULT | Default behaviour: wxStringTokenizer will behave in the same way as `strtok()` (wxTOKEN_STRTOK) if the delimiters string only contains white space characters but, unlike the standard function, it will behave like wxTOKEN_RET_EMPTY, returning empty tokens if this is not the case. This is helpful for parsing strictly formatted data where the number of fields is fixed but some of them may be empty (i.e. `TAB` or comma delimited text files).
wxTOKEN_RET_EMPTY | In this mode, the empty tokens in the middle of the string will be returned, i.e. `"a::b:"` will be tokenized in three tokens `'a'`, `''` and `'b'`. Notice that all trailing delimiters are ignored in this mode, not just the last one, i.e. a string `"a::b::"` would still result in the same set of tokens.
wxTOKEN_RET_EMPTY_ALL | In this mode, empty trailing tokens (including the one after the last delimiter character) will be returned as well. The string `"a::b:"` will be tokenized in four tokens: the already mentioned ones and another empty one as the last one and a string `"a::b::"` will have five tokens.
wxTOKEN_RET_DELIMS | In this mode, the delimiter character after the end of the current token (there may be none if this is the last token) is returned appended to the token. Otherwise, it is the same mode as wxTOKEN_RET_EMPTY. Notice that there is no mode like this one but behaving like wxTOKEN_RET_EMPTY_ALL instead of wxTOKEN_RET_EMPTY, use wxTOKEN_RET_EMPTY_ALL and wxStringTokenizer::GetLastDelimiter() to emulate it.
wxTOKEN_STRTOK | In this mode the class behaves exactly like the standard `strtok()` function: the empty tokens are never returned.