utils/include/io

Defines

MAX_PRECISION

Used to output maximum precision to screen [e.g., INFO(MAX_PRECISION << “energy: ” << energy)].

namespace feasst

Functions

std::string install_dir()

Return the feasst install directory as a string.

std::string version()

Return the feasst version as a string.

template<class T>
std::string feasst_str(const std::vector<T> &vec, const bool max_precision = false)

Return string representation of vector.

template<class T>
std::string feasst_str(const std::vector<std::vector<T>> &vec, const bool max_precision = false)
template<class T>
std::string feasst_str(const std::deque<T> &deq, const bool max_precision = false)
std::string str(const std::map<std::string, std::string> &mp)

Print a std::map of a pair of strings in human readable format.

std::vector<std::string> split(const std::string str)

Split a string into a vector of strings via space delimitors.

std::string trim(const char *specialchr, const char *phrase, int from_left = 1)

Return phrase with all characters up to the last specialchr removed.

param from_left:

If 1, remove characters from the left. Otherwise, remove characters from the right.

std::string trim(const char *specialchr, std::string phrase, int from_left = 1)

Same as above except for string phrase.

template<typename T>
std::string str(const T a_value)

Convert to string with maximum precision.

int num_spaces(const std::string str)

Return the number of spaces in string.

bool is_found_in(const std::string &str, const std::string &substr)

Return true if substring is found inside of string.

bool replace(const std::string &from, const std::string &to, std::string *str)

Replace substring “from” in “str” to “to”. Return true if replaced. https://stackoverflow.com/questions/3418231/replace-part-of-a-string-with-another-string

int str_to_int(const std::string &str)

Convert a string to an integer.

double str_to_double(const std::string &str)

Convert a string to an double.

bool str_to_bool(const std::string &str)

Convert a string to a boolean.

std::string sized_int_to_str(const int num, const int largest_num)

Print an integer with the maximum number of digits as given largest integer.