19 #ifndef StringTokenizer_h 20 #define StringTokenizer_h 92 StringTokenizer(std::string tosplit, std::string token,
bool splitAtAllChars =
false);
123 std::string
get(
int pos)
const;
130 void prepare(
const std::string& tosplit,
const std::string& token,
bool splitAtAllChars);
void reinit()
reinitialises the internal iterator
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static const int WHITECHARS
identifier for splitting the given string at all whitespace characters
std::string myTosplit
the string to split
static const int NEWLINE
identifier for splitting the given string at all newline characters
bool hasNext()
returns the information whether further substrings exist
StringTokenizer()
default constructor
void prepare(const std::string &tosplit, const std::string &token, bool splitAtAllChars)
splits the first string at all occurences of the second. If the third parameter is true split at all ...
~StringTokenizer()
destructor
int size() const
returns the number of existing substrings
SizeVector myLengths
the list of substring lengths
static const int SPACE
the ascii index of the highest whitespace character
std::vector< int > SizeVector
a list of positions/lengths
SizeVector myStarts
the list of substring starts
std::string front()
returns the first substring without moving the iterator
static const int TAB
the ascii index of the tab character
std::vector< std::string > getVector()
return vector of strings
void prepareWhitechar(const std::string &tosplit)
splits the first string at all occurences of whitechars
int myPos
the current position in the list of substrings