class NoSuchElementException
|
Exception thrown, if someone tried to read beyond the
end of the tokens. More... |
|
|
Public Members
Detailed Description
Exception thrown, if someone tried to read beyond the
end of the tokens.
Will not happen if you use it the 'clean' way with comparison
against end(), but if you skip some tokens, because you 'know'
they are there. Simplifies error handling a lot, since you can
just read your tokens the way you expect it, and if there is some
error in the input this Exception will be thrown.
StringTokenizer (const char *str, const char *delim, bool skipAllDelim = false, bool trim = false)
|
creates a new StringTokenizer for a string
and a given set of delimiters.
Parameters:
str | String to be split up. This string will
not be modified by this StringTokenizer,
but you may as well not modfiy this string
while tokenizing is in process, which may
lead to undefined behaviour.
|
delim | String containing the characters
which should be regarded as delimiters.
|
skipAllDelim | OPTIONAL.
true, if subsequent
delimiters should be skipped at once
or false, if empty tokens should
be returned for two delimiters with
no other text inbetween. The first
behaviour may be desirable for whitespace
skipping, the second for input with
delimited entry e.g. /etc/passwd like files
or CSV input.
NOTE, that 'true' here resembles the
ANSI-C strtok(char *s,char *d) behaviour.
DEFAULT = false
|
trim | OPTIONAL.
true, if the tokens returned
should be trimmed, so that they don't have
any whitespaces at the beginning or end.
Whitespaces are any of the characters
defined in StringTokenizer::SPACE.
If delim itself is StringTokenizer::SPACE,
this will result in a behaviour with
skipAllDelim = true.
DEFAULT = false
|
StringTokenizer (const char *s)
|
create a new StringTokenizer which splits the input
string at whitespaces. The tokens are stripped from
whitespaces. This means, if you change the set of
delimiters in either the 'begin(const char *delim)' method
or in 'setDelimiters()', you then get whitespace
trimmed tokens, delimited by the new set.
Behaves like StringTokenizer(s, StringTokenizer::SPACE,false,true);
[const]
returns the begin iterator
void setDelimiters (const char *d)
|
changes the set of delimiters used in subsequent
iterations.
iterator begin (const char *d)
|
returns a begin iterator with an alternate set of
delimiters.
[const]
the iterator marking the end.
Generated by: dyfet@home.sys on Fri Aug 11 16:43:58 200. |