1999-01-24 15:23:54 +00:00
|
|
|
\section{\class{wxStringTokenizer}}\label{wxstringtokenizer}
|
|
|
|
|
|
|
|
wxStringTokenizer helps you to break a string up into a number of tokens.
|
|
|
|
|
2000-01-31 20:46:49 +00:00
|
|
|
To use this class, you should create a wxStringTokenizer object, give it the
|
|
|
|
string to tokenize and also the delimiters which separate tokens in the string
|
|
|
|
(by default, white space characters will be used).
|
|
|
|
|
|
|
|
Then \helpref{GetNextToken}{wxstringtokenizergetnexttoken} may be called
|
|
|
|
repeatedly until it \helpref{HasMoreTokens}{wxstringtokenizerhasmoretokens}
|
|
|
|
returns FALSE.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
|
|
|
|
wxStringTokenizer tkz("first:second:third::fivth", ":");
|
|
|
|
while ( tkz.HasMoreTokens() )
|
|
|
|
{
|
|
|
|
wxString token = tkz.GetNextToken();
|
|
|
|
|
|
|
|
// process token here
|
|
|
|
}
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
Another feature of this class is that it may return the delimiter which
|
|
|
|
was found after the token with it. In a simple case like above, you are not
|
|
|
|
interested in this because the delimiter is always {\tt ':'}, but if the
|
|
|
|
delimiters string has several characters, you might need to know which of them
|
|
|
|
follows the current token. In this case, pass {\tt TRUE} to wxStringTokenizer
|
|
|
|
constructor or \helpref{SetString}{wxstringtokenizersetstring} method and
|
|
|
|
the delimiter will be appended to each returned token (except for the last
|
|
|
|
one).
|
|
|
|
|
1999-01-24 15:23:54 +00:00
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 20:41:29 +00:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/tokenzr.h>
|
|
|
|
|
1999-01-24 15:23:54 +00:00
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxStringTokenizer::wxStringTokenizer}\label{wxstringtokenizerwxstringtokenizer}
|
|
|
|
|
1999-02-16 20:17:02 +00:00
|
|
|
\func{}{wxStringTokenizer}{\void}
|
|
|
|
|
|
|
|
Default constructor.
|
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\func{}{wxStringTokenizer}{\param{const wxString\& }{to\_tokenize}, \param{const wxString\& }{delims = " $\backslash$t$\backslash$r$\backslash$n"}, \param{bool }{ret\_delim = FALSE}}
|
1999-01-24 15:23:54 +00:00
|
|
|
|
1999-02-16 20:17:02 +00:00
|
|
|
Constructor. Pass the string to tokenize, a string containing delimiters,
|
2000-01-31 20:46:49 +00:00
|
|
|
a flag specifying whether to return delimiters with tokens.
|
1999-01-24 15:23:54 +00:00
|
|
|
|
|
|
|
\membersection{wxStringTokenizer::\destruct{wxStringTokenizer}}\label{wxstringtokenizerdtor}
|
|
|
|
|
|
|
|
\func{}{\destruct{wxStringTokenizer}}{\void}
|
|
|
|
|
|
|
|
Destructor.
|
|
|
|
|
|
|
|
\membersection{wxStringTokenizer::CountTokens}\label{wxstringtokenizercounttokens}
|
|
|
|
|
1999-02-24 08:02:28 +00:00
|
|
|
\constfunc{int}{CountTokens}{\void}
|
1999-01-24 15:23:54 +00:00
|
|
|
|
|
|
|
Returns the number of tokens in the input string.
|
|
|
|
|
1999-02-24 08:02:28 +00:00
|
|
|
\membersection{wxStringTokenizer::HasMoreTokens}\label{wxstringtokenizerhasmoretokens}
|
1999-01-24 15:23:54 +00:00
|
|
|
|
1999-02-24 08:02:28 +00:00
|
|
|
\constfunc{bool}{HasMoreTokens}{\void}
|
1999-01-24 15:23:54 +00:00
|
|
|
|
|
|
|
Returns TRUE if the tokenizer has further tokens.
|
|
|
|
|
1999-02-24 08:02:28 +00:00
|
|
|
\membersection{wxStringTokenizer::GetNextToken}\label{wxstringtokenizergetnexttoken}
|
1999-01-24 15:23:54 +00:00
|
|
|
|
1999-02-24 08:02:28 +00:00
|
|
|
\constfunc{wxString}{GetNextToken}{\void}
|
1999-01-24 15:23:54 +00:00
|
|
|
|
2000-01-31 20:46:49 +00:00
|
|
|
Returns the next token or empty string if the end of string was reached.
|
|
|
|
|
|
|
|
\membersection{wxStringTokenizer::GetPosition}\label{wxstringtokenizergetposition}
|
|
|
|
|
|
|
|
\constfunc{size\_t}{GetPosition}{\void}
|
|
|
|
|
|
|
|
Returns the current position (i.e. one index after the last returned
|
|
|
|
token or 0 if GetNextToken() has never been called) in the original
|
|
|
|
string.
|
1999-01-24 15:23:54 +00:00
|
|
|
|
|
|
|
\membersection{wxStringTokenizer::GetString}\label{wxstringtokenizergetstring}
|
|
|
|
|
1999-02-24 08:02:28 +00:00
|
|
|
\constfunc{wxString}{GetString}{\void}
|
1999-01-24 15:23:54 +00:00
|
|
|
|
2000-01-31 20:46:49 +00:00
|
|
|
Returns the part of the starting string without all token already extracted.
|
1999-01-24 15:23:54 +00:00
|
|
|
|
1999-02-16 20:17:02 +00:00
|
|
|
\membersection{wxStringTokenizer::SetString}\label{wxstringtokenizersetstring}
|
|
|
|
|
|
|
|
\func{void}{SetString}{\param{const wxString\& }{to\_tokenize}, \param{const wxString\& }{delims = " $\backslash$t$\backslash$r$\backslash$n"}, \param{bool }{ret\_delim = FALSE}}
|
1999-01-24 15:23:54 +00:00
|
|
|
|
1999-02-16 20:17:02 +00:00
|
|
|
Initializes the tokenizer.
|
|
|
|
|
|
|
|
Pass the string to tokenize, a string containing delimiters,
|
2000-01-31 20:46:49 +00:00
|
|
|
a flag specifying whether to return delimiters with tokens.
|
1999-01-24 15:23:54 +00:00
|
|
|
|