class ParseString : public string

Subclass of string with added functionaity for parsing

Inheritance:


Public Methods

void lower(void)
Converts the entire string to lower case letters
ParseString(char *value)
Constructor taking a character array to initialize the string
ParseString(void)
Constructor taking no arguments
void tidy(void)
Removes preceeding and excess spaces
string token(int n, char delim=' ')
Returns the given token in the string using the delimiter

Documentation

Subclass of string with added functionaity for parsing. The added functions are to simplify the task of parsing strings to look for specific keywords. The new routines can convert the string to lower case, tidy up the spacing and then split the string according to a given delimiter.
ParseString(char *value)
Constructor taking a character array to initialize the string. The routine simply calls the base class string constructor function which takes a character array as an argument.

ParseString(void)
Constructor taking no arguments. The routine simply calls the base class string constructor function which requires no arguments.

void tidy(void)
Removes preceeding and excess spaces. The routine loops over the string removing any spaces in front of the text. It then reduces spacing in the string to single space characters. For example the string " hello there" would become "hello there" after a call to tidy.

void lower(void)
Converts the entire string to lower case letters. Loops over the string elements and if they are capital letters it converts them to the lower case equivalent.

string token(int n, char delim=' ')
Returns the given token in the string using the delimiter. The routine loops over the string elements looking for the delimiter character. When it is found it will mark the beginning of the token and continue looping until it finds the next delimiter or end of the string which marks the end of the token. It then uses the substr method inherited from string to return the token substring. Token zero starts at the begining of the string and ends at the first delimiter or end of the string.
Parameters:
n - number of token requested
delim - delimiter character used to divide the string


This class has no child classes.
Author:
Roger Moore (moore@pa.msu.edu)

alphabetic index hierarchy of classes


This page has been generated automatically by doc++.

Copyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de