Functions | |
std::string | fmt (size_t size, const char *fmt,...) |
Format a string. | |
void | clean (std::string &str, const char *chars=" \n\t") |
Remove leading and trailing characters from a string. | |
std::string | cleaned (const std::string &str, const char *chars=" \n\t") |
Remove leading and trailing characters from a string. | |
std::vector< std::string > | split (const std::string &str, const char *delims, bool group, unsigned int num_fields=0) |
Split a string to fields. | |
long | str2long (const std::string &str, int base=10) |
Convert a string to signed long. | |
unsigned long | str2ulong (const std::string &str, int base=10) |
Convert a string to unsigned long. | |
float | str2float (const std::string &str) |
Convert a string to float. | |
template<class T> | |
std::vector< T > | long_vec (const std::string &str) |
Convert a string to a vector of integers using str2long(). | |
std::vector< float > | float_vec (const std::string &str) |
Convert a string to a vector of floats using str2float(). | |
std::string | chomped (const std::string &str, const char *chars="\n") |
Return a strin with the possible trailing newline removed. | |
std::string & | chomp (std::string &str, const char *chars="\n") |
Remove the possible trailing newline from a string. | |
bool | read_line (std::string &str, FILE *file=stdin, bool do_chomp=false) |
Read a line from a file. |
|
Remove the possible trailing newline from a string.
|
|
Return a strin with the possible trailing newline removed.
|
|
Remove leading and trailing characters from a string.
|
|
Remove leading and trailing characters from a string.
|
|
Convert a string to a vector of floats using str2float().
|
|
Format a string.
|
|
Convert a string to a vector of integers using str2long().
|
|
Read a line from a file.
|
|
Split a string to fields.
If
|
|
Convert a string to float. Arbitrary amount of white space is accepted before the float as explained on strtof(3) manual page. Anything after the number is considered as an conversion error.
|
|
Convert a string to signed long. Arbitrary amount of white space is accepted before the number as explained on strtol(3) manual page. Anything after the number is considered as an conversion error.
|
|
Convert a string to unsigned long. Arbitrary amount of white space is accepted before the number as explained on strtol(3) manual page. Anything after the number is considered as an conversion error.
|