Functions |
bool | suplib::iscomment (const string &str, const string &ignore=" \t", 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=10) throw ( Exception ) |
| convert string to integer number
|
long | suplib::str2l (const char *txt, int base=10) throw ( Exception ) |
| convert string to long number
|
unsigned long | suplib::str2ul (const char *txt, int base=10) throw ( Exception ) |
| convert string to long number
|
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
|
string & | suplib::trim (string &str) |
| remove leading white space from a string
|
bool suplib::iscomment |
( |
const string & |
str, |
|
|
const string & |
ignore = " \t" , |
|
|
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.
template<typename Container >
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
- 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.