#include <StringTokenizer.h>
Public Member Functions | |
StringTokenizer (const std::string &str, const std::string &delim=" \t\n\r\f", bool returnDelims=false) | |
virtual | ~StringTokenizer (void) |
virtual int | countTokens (void) const |
virtual bool | hasMoreTokens (void) const |
virtual std::string | nextToken (void) throw ( exceptions::NoSuchElementException ) |
virtual std::string | nextToken (const std::string &delim) throw ( exceptions::NoSuchElementException ) |
virtual unsigned int | toArray (std::vector< std::string > &array) |
virtual void | reset (const std::string &str="", const std::string &delim="", bool returnDelims=false) |
Private Attributes | |
std::string | str |
std::string | delim |
std::string::size_type | pos |
bool | returnDelims |
|
Constructs a string tokenizer for the specified string. All characters in the delim argument are the delimiters for separating tokens. If the returnDelims flag is true, then the delimiter characters are also returned as tokens. Each delimiter is returned as a string of length one. If the flag is false, the delimiter characters are skipped and only serve as separators between tokens. Note that if delim is "", this constructor does not throw an exception. However, trying to invoke other methods on the resulting StringTokenizer may result in an Exception.
|
|
|
|
Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception. The current position is not advanced.
|
|
Tests if there are more tokens available from this tokenizer's string.
|
|
Returns the next token in this string tokenizer's string. First, the set of characters considered to be delimiters by this StringTokenizer object is changed to be the characters in the string delim. Then the next token in the string after the current position is returned. The current position is advanced beyond the recognized token. The new delimiter set remains the default after this call.
|
|
Returns the next token from this string tokenizer.
|
|
Resets the Tokenizer's position in the String to the Beginning calls to countToken and nextToken now start back at the beginning. This allows this object to be reused, the caller need not create a new instance every time a String needs tokenizing. If set the string param will reset the string that this Tokenizer is working on. If set to "" no change is made. If set the delim param will reset the string that this Tokenizer is using to tokenizer the string. If set to "", no change is made If set the return Delims will set if this Tokenizer will return delimiters as tokens. Defaults to false.
|
|
Grab all remaining tokens in the String and return them in the vector that is passed in by reference.
|
|
|
|
|
|
|
|
|