Classes | |
class | wxStringTokenizer |
wxStringTokenizer helps you to break a string up into a number of tokens. 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... |
The behaviour of wxStringTokenizer is governed by the wxStringTokenizer::wxStringTokenizer() or wxStringTokenizer::SetString() with the parameter mode, which may be one of the following:.
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. |
wxTOKEN_RET_EMPTY |
In this mode, the empty tokens in the middle of the string will be returned, i.e.
|
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 |
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. |
![]() |
[ top ] |