1 \section{\class{wxStringTokenizer
}}\label{wxstringtokenizer
}
3 wxStringTokenizer helps you to break a string up into a number of tokens.
5 To use this class, you should create a wxStringTokenizer object, give it the
6 string to tokenize and also the delimiters which separate tokens in the string
7 (by default, white space characters will be used).
9 Then
\helpref{GetNextToken
}{wxstringtokenizergetnexttoken
} may be called
10 repeatedly until it
\helpref{HasMoreTokens
}{wxstringtokenizerhasmoretokens
}
17 wxStringTokenizer tkz("first:second:third::fivth", ":");
18 while ( tkz.HasMoreTokens() )
20 wxString token = tkz.GetNextToken();
26 Another feature of this class is that it may return the delimiter which
27 was found after the token with it. In a simple case like above, you are not
28 interested in this because the delimiter is always
{\tt ':'
}, but if the
29 delimiters string has several characters, you might need to know which of them
30 follows the current token. In this case, pass
{\tt TRUE
} to wxStringTokenizer
31 constructor or
\helpref{SetString
}{wxstringtokenizersetstring
} method and
32 the delimiter will be appended to each returned token (except for the last
35 \wxheading{Derived from
}
37 \helpref{wxObject
}{wxobject
}
39 \wxheading{Include files
}
43 \latexignore{\rtfignore{\wxheading{Members
}}}
45 \membersection{wxStringTokenizer::wxStringTokenizer
}\label{wxstringtokenizerwxstringtokenizer
}
47 \func{}{wxStringTokenizer
}{\void}
51 \func{}{wxStringTokenizer
}{\param{const wxString\&
}{to
\_tokenize},
\param{const wxString\&
}{delims = " $
\backslash$t$
\backslash$r$
\backslash$n"
},
\param{bool
}{ret
\_delim = FALSE
}}
53 Constructor. Pass the string to tokenize, a string containing delimiters,
54 a flag specifying whether to return delimiters with tokens.
56 \membersection{wxStringTokenizer::
\destruct{wxStringTokenizer
}}\label{wxstringtokenizerdtor
}
58 \func{}{\destruct{wxStringTokenizer
}}{\void}
62 \membersection{wxStringTokenizer::CountTokens
}\label{wxstringtokenizercounttokens
}
64 \constfunc{int
}{CountTokens
}{\void}
66 Returns the number of tokens in the input string.
68 \membersection{wxStringTokenizer::HasMoreTokens
}\label{wxstringtokenizerhasmoretokens
}
70 \constfunc{bool
}{HasMoreTokens
}{\void}
72 Returns TRUE if the tokenizer has further tokens.
74 \membersection{wxStringTokenizer::GetNextToken
}\label{wxstringtokenizergetnexttoken
}
76 \constfunc{wxString
}{GetNextToken
}{\void}
78 Returns the next token or empty string if the end of string was reached.
80 \membersection{wxStringTokenizer::GetPosition
}\label{wxstringtokenizergetposition
}
82 \constfunc{size
\_t}{GetPosition
}{\void}
84 Returns the current position (i.e. one index after the last returned
85 token or
0 if GetNextToken() has never been called) in the original
88 \membersection{wxStringTokenizer::GetString
}\label{wxstringtokenizergetstring
}
90 \constfunc{wxString
}{GetString
}{\void}
92 Returns the part of the starting string without all token already extracted.
94 \membersection{wxStringTokenizer::SetString
}\label{wxstringtokenizersetstring
}
96 \func{void
}{SetString
}{\param{const wxString\&
}{to
\_tokenize},
\param{const wxString\&
}{delims = " $
\backslash$t$
\backslash$r$
\backslash$n"
},
\param{bool
}{ret
\_delim = FALSE
}}
98 Initializes the tokenizer.
100 Pass the string to tokenize, a string containing delimiters,
101 a flag specifying whether to return delimiters with tokens.