#include <string>
#include <vector>
#include <stdexcept>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>
Go to the source code of this file.
Namespaces | |
namespace | str |
Functions | |
std::string | str::fmt (size_t size, const char *fmt,...) |
Format a string. | |
void | str::clean (std::string &str, const char *chars=" \n\t") |
Remove leading and trailing characters from a string. | |
std::string | str::cleaned (const std::string &str, const char *chars=" \n\t") |
Remove leading and trailing characters from a string. | |
std::vector< std::string > | str::split (const std::string &str, const char *delims, bool group, unsigned int num_fields=0) |
Split a string to fields. | |
long | str::str2long (const std::string &str, int base=10) |
Convert a string to signed long. | |
unsigned long | str::str2ulong (const std::string &str, int base=10) |
Convert a string to unsigned long. | |
float | str::str2float (const std::string &str) |
Convert a string to float. | |
template<class T> | |
std::vector< T > | str::long_vec (const std::string &str) |
Convert a string to a vector of integers using str2long(). | |
std::vector< float > | str::float_vec (const std::string &str) |
Convert a string to a vector of floats using str2float(). | |
std::string | str::chomped (const std::string &str, const char *chars="\n") |
Return a strin with the possible trailing newline removed. | |
std::string & | str::chomp (std::string &str, const char *chars="\n") |
Remove the possible trailing newline from a string. | |
bool | str::read_line (std::string &str, FILE *file=stdin, bool do_chomp=false) |
Read a line from a file. |