|
A library for working with phylogenetic and population genetic data.
v0.27.0
|
|
Go to the documentation of this file.
59 if( cont ==
"true" || cont ==
"yes" || cont ==
"on" || cont ==
"1" ) {
62 }
else if( cont.empty() || cont ==
"false" || cont ==
"no" || cont ==
"off" || cont ==
"0" ) {
73 throw std::runtime_error(
"String is not convertible to bool." );
98 if( cont ==
"true" || cont ==
"yes" || cont ==
"on" || cont ==
"1" ) {
101 }
else if( cont ==
"false" || cont ==
"no" || cont ==
"off" || cont ==
"0" ) {
104 }
else if( cont.empty() ) {
105 result = std::numeric_limits<double>::quiet_NaN();
117 throw std::runtime_error(
"String is not convertible to bool." );
139 result = std::numeric_limits<double>::quiet_NaN();
146 auto const val =
trim( str );
147 std::string::size_type sz;
148 result = std::stod( val, &sz );
149 if( sz != val.size() ) {
162 throw std::runtime_error(
"String is not convertible to double." );
bool is_convertible_to_bool_double(std::string const &str)
double convert_to_bool_double(std::string const &str)
bool convert_to_bool_double_(std::string const &str, double &result)
Local helper function. Converts a string to bool, but stores it as a double, storing the result in re...
bool is_convertible_to_bool(Dataframe const &df, size_t col_index)
std::string trim(std::string const &s, std::string const &delimiters)
Return a copy of the input string, with trimmed white spaces.
bool convert_to_double_(std::string const &str, double &result)
Local helper function. Converts a string to double, storing the result in result, and returning wheth...
bool convert_to_bool_(std::string const &str, bool &result)
Local helper function. Converts a string to bool, storing the result in result, and returning whether...
void convert_to_double(Dataframe &df, size_t col_index)
Provides some commonly used string utility functions.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
bool is_convertible_to_double(Dataframe const &df, size_t col_index)
std::string to_lower_ascii(std::string const &str)
Return an all-lowercase copy of the given string, ASCII-only.
void convert_to_bool(Dataframe &df, size_t col_index)