suplibxx  1.3.13
String

Functions

bool suplib::iscomment (const std::string &str, const std::string &ignore=" \t", const std::string &comment="#")
 determine if the string is a comment. More...
 
std::string & suplib::prune (std::string &str)
 remove leading and trailing white space from a string More...
 
double suplib::str2d (const char *txt)
 convert string to double-precision number More...
 
float suplib::str2f (const char *txt)
 convert string to floating-point number More...
 
int suplib::str2i (const char *txt, int base=10)
 convert string to integer number More...
 
long suplib::str2l (const char *txt, int base=10)
 convert string to long number More...
 
unsigned long suplib::str2ul (const char *txt, int base=10)
 convert string to long number More...
 
std::string & suplib::trim (std::string &str)
 remove leading white space from a string More...
 

Detailed Description

Function Documentation

◆ iscomment()

bool suplib::iscomment ( const std::string &  str,
const std::string &  ignore = " \t",
const std::string &  comment = "#" 
)

determine if the string is a comment.

Parameters
strthe 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 45 of file iscomment.cc.

◆ prune()

std::string & suplib::prune ( std::string &  str)

remove leading and trailing white space from a string

Parameters
strthe 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 46 of file prune.cc.

◆ str2d()

double suplib::str2d ( const char *  txt)

convert string to double-precision number

Parameters
txtthe 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.

◆ str2f()

float suplib::str2f ( const char *  txt)

convert string to floating-point number

Parameters
txtthe 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 41 of file str2f.cc.

◆ str2i()

int suplib::str2i ( const char *  txt,
int  base = 10 
)

convert string to integer number

Parameters
txtthe 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 43 of file str2i.cc.

◆ str2l()

long suplib::str2l ( const char *  txt,
int  base = 10 
)

convert string to long number

Parameters
txtthe 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 46 of file str2l.cc.

◆ str2ul()

unsigned long suplib::str2ul ( const char *  txt,
int  base = 10 
)

convert string to long number

Parameters
txtthe 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 46 of file str2ul.cc.

◆ trim()

std::string & suplib::trim ( std::string &  str)

remove leading white space from a string

Parameters
strthe 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 48 of file trim.cc.