String


Functions

bool suplib::iscomment (const string &str, const string &ignore, const string &comment)
 determine if the string is a comment.
string & suplib::prune (string &str)
 remove leading and trailing white space from a string
double suplib::str2d (const char *txt) throw ( Exception )
 convert string to double-precision number
float suplib::str2f (const char *txt) throw ( Exception )
 convert string to floating-point number
int suplib::str2i (const char *txt, int base) throw ( Exception )
 convert string to integer number
long suplib::str2l (const char *txt, int base) throw ( Exception )
 convert string to long number
unsigned long suplib::str2ul (const char *txt, int base) throw ( Exception )
 convert string to long number
string & suplib::trim (string &str)
 remove leading white space from a string
template<typename Container>
void suplib::tok (Container &container, string const &in, const char *const delimiters=" \t\n", bool skip=true)
 split a string into tokens

Function Documentation

bool suplib::iscomment ( const string &  str,
const string &  ignore,
const string &  comment 
)

determine if the string is a comment.

Parameters:
str the string upon which to operate
iscomment scans str to determine if the first character following all the ignore characters is a comment character. It compares the position of the first non-ignore character with the position of the first comment character. If they are the same and occur before the end of the string, it returns true. Otherwise it returns false.

Returns:
It returns true if line is a comment.

Definition at line 48 of file iscomment.cc.

string & suplib::prune ( string &  str  ) 

remove leading and trailing white space from a string

Parameters:
str the string upon which to operate
prune deletes leading and trailing white space, where white space is defined as blanks, tabs, new lines, and carriage returns.

Returns:
It returns the passed reference

Definition at line 48 of file prune.cc.

double suplib::str2d ( const char *  txt  )  throw ( Exception )

convert string to double-precision number

Parameters:
txt the string upon which to operate
str2d() converts the initial portion of the string pointed to by txt to type double representation. It throws an exception, of type Exception, if txt is not a legitimate double precision number.

Returns:
It returns the double precision number

Definition at line 44 of file str2d.cc.

float suplib::str2f ( const char *  txt  )  throw ( Exception )

convert string to floating-point number

Parameters:
txt the string upon which to operate
str2f() converts the initial portion of the string pointed to by txt to type float representation. It throws an exception, of type Exception, if txt is not a legitimate floating point number.

Returns:
It returns the floating point number

Definition at line 39 of file str2f.cc.

int suplib::str2i ( const char *  txt,
int  base 
) throw ( Exception )

convert string to integer number

Parameters:
txt the string upon which to operate
str2i() converts the initial portion of the string pointed to by txt to type integer representation. It throws an exception, of type Exception, if txt is not a legitimate integer.

Returns:
It returns the integer.

Definition at line 40 of file str2i.cc.

long suplib::str2l ( const char *  txt,
int  base 
) throw ( Exception )

convert string to long number

Parameters:
txt the string upon which to operate
str2l() converts the initial portion of the string pointed to by txt to type long representation. It throws an exception, of type Exception, if txt is not a legitimate long.

Returns:
It returns the long.

Definition at line 44 of file str2l.cc.

unsigned long suplib::str2ul ( const char *  txt,
int  base 
) throw ( Exception )

convert string to long number

Parameters:
txt the string upon which to operate
str2ul() converts the initial portion of the string pointed to by txt to type unsigned long representation. It throws an exception, of type Exception, if txt is not a legitimate long.

Returns:
It returns the long.

Definition at line 44 of file str2ul.cc.

template<typename Container>
template< typename Container > void suplib::tok ( Container &  container,
string const &  in,
const char *const   delimiters = " \t\n",
bool  skip = true 
) [inline]

split a string into tokens

Parameters:
container the reference to a C++ container object into which the parsed string goes.
in the string to parse.
delimiters the characters which delimit tokens.
skip consecutive delimiters are skipped.
Splits the input string, in, on one or more of the characters in delimiters. The tokens are placed in container.

Returns:
void

Definition at line 60 of file str.h.

string & suplib::trim ( string &  str  ) 

remove leading white space from a string

Parameters:
str the string upon which to operate
trim deletes leading white space, where white space is defined as blanks, tabs, new lines, and carriage returns.

Returns:
It returns the passed reference

Definition at line 49 of file trim.cc.


Generated on Thu Oct 2 20:49:06 2008 for suplibxx by  doxygen 1.5.6