Various string conversion functions. More...
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
#include <limits>
#include <o2scl/misc.h>
Go to the source code of this file.
Namespaces | |
o2scl | |
The main O2scl namespace. | |
Functions | |
Functions in src/base/string_conv.h | |
std::string | o2scl::ptos (void *p) |
Convert a pointer to a string. More... | |
std::string | o2scl::itos (int x) |
Convert an integer to a string. | |
std::string | o2scl::szttos (size_t x) |
Convert a size_t to a string. | |
std::string | o2scl::btos (bool b) |
Convert a boolean value to a string. More... | |
template<class fp_t > | |
std::string | o2scl::dtos (const fp_t &x, int prec=6, bool auto_prec=false) |
Convert a double to a string. More... | |
size_t | o2scl::size_of_exponent (double x) |
Returns the number of characters required to display the exponent of x in scientific mode. More... | |
std::string | o2scl::dtos (double x, std::ostream &format) |
Convert a double to a string using a specified format. | |
int | o2scl::stoi (std::string s) |
Convert a string to an integer. More... | |
int | o2scl::stoi_nothrow (std::string s, int &result) |
Convert a string to an integer without throwing an exception. | |
size_t | o2scl::stoszt (std::string s) |
Convert a string to a size_t. More... | |
int | o2scl::stoszt_nothrow (std::string s, size_t &result) |
Convert a string to a size_t without throwing an exception. More... | |
bool | o2scl::stob (std::string s, bool err_on_fail=true) |
Convert a string to a boolean value. More... | |
double | o2scl::stod (std::string s) |
Convert a string to a double. More... | |
int | o2scl::stod_nothrow (std::string s, double &result) |
Convert a string to a double returning non-zero value for failure. | |
bool | o2scl::has_minus_sign (double *x) |
Find out if the number pointed to by x has a minus sign. More... | |
bool | o2scl::is_number (std::string s) |
Return true if the string s is likely a integral or floating point number. More... | |
double | o2scl::function_to_double (std::string s) |
Convert a formula to a double. More... | |
int | o2scl::function_to_double_nothrow (std::string s, double &result) |
Convert a formula to a double and return an integer to indicate success or failure. More... | |
void | o2scl::split_string (std::string str, std::vector< std::string > &sv) |
Split a string into words using whitespace for delimiters and (partially) respecting quotes. More... | |
int | o2scl::split_string_delim (std::string str, std::vector< std::string > &list, char delim) |
Split a string into parts using a delimiter. | |
void | o2scl::rewrap (std::string str, std::vector< std::string > &sv, size_t ncol=79) |
Rewrap a string into a single column, avoiding strings less than a particular number of characters. | |
void | o2scl::rewrap_keep_endlines (std::string str, std::vector< std::string > &sv, size_t ncol=79) |
Rewrap a string into a single column, avoiding strings less than a particular number of characters. More... | |
template<class size_vec_t > | |
int | o2scl::string_to_uint_list (const std::string &x, size_vec_t &list) |
Convert a string-based list of unsigned integers to a list. | |
Functions in src/base/string_conv.h | |
std::string | o2scl::ptos (void *p) |
Convert a pointer to a string. More... | |
std::string | o2scl::itos (int x) |
Convert an integer to a string. | |
std::string | o2scl::szttos (size_t x) |
Convert a size_t to a string. | |
std::string | o2scl::btos (bool b) |
Convert a boolean value to a string. More... | |
template<class fp_t > | |
std::string | o2scl::dtos (const fp_t &x, int prec=6, bool auto_prec=false) |
Convert a double to a string. More... | |
size_t | o2scl::size_of_exponent (double x) |
Returns the number of characters required to display the exponent of x in scientific mode. More... | |
std::string | o2scl::dtos (double x, std::ostream &format) |
Convert a double to a string using a specified format. | |
int | o2scl::stoi (std::string s) |
Convert a string to an integer. More... | |
int | o2scl::stoi_nothrow (std::string s, int &result) |
Convert a string to an integer without throwing an exception. | |
size_t | o2scl::stoszt (std::string s) |
Convert a string to a size_t. More... | |
int | o2scl::stoszt_nothrow (std::string s, size_t &result) |
Convert a string to a size_t without throwing an exception. More... | |
bool | o2scl::stob (std::string s, bool err_on_fail=true) |
Convert a string to a boolean value. More... | |
double | o2scl::stod (std::string s) |
Convert a string to a double. More... | |
int | o2scl::stod_nothrow (std::string s, double &result) |
Convert a string to a double returning non-zero value for failure. | |
bool | o2scl::has_minus_sign (double *x) |
Find out if the number pointed to by x has a minus sign. More... | |
bool | o2scl::is_number (std::string s) |
Return true if the string s is likely a integral or floating point number. More... | |
double | o2scl::function_to_double (std::string s) |
Convert a formula to a double. More... | |
int | o2scl::function_to_double_nothrow (std::string s, double &result) |
Convert a formula to a double and return an integer to indicate success or failure. More... | |
void | o2scl::split_string (std::string str, std::vector< std::string > &sv) |
Split a string into words using whitespace for delimiters and (partially) respecting quotes. More... | |
int | o2scl::split_string_delim (std::string str, std::vector< std::string > &list, char delim) |
Split a string into parts using a delimiter. | |
void | o2scl::rewrap (std::string str, std::vector< std::string > &sv, size_t ncol=79) |
Rewrap a string into a single column, avoiding strings less than a particular number of characters. | |
void | o2scl::rewrap_keep_endlines (std::string str, std::vector< std::string > &sv, size_t ncol=79) |
Rewrap a string into a single column, avoiding strings less than a particular number of characters. More... | |
template<class size_vec_t > | |
int | o2scl::string_to_uint_list (const std::string &x, size_vec_t &list) |
Convert a string-based list of unsigned integers to a list. | |
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).