9 #ifndef CT_STRINGUTILS_H 10 #define CT_STRINGUTILS_H 14 #include <boost/algorithm/string.hpp> 21 namespace ba = boost::algorithm;
29 std::string
fp2str(
const double x,
const std::string& fmt=
"%g");
37 std::string
int2str(
const int n,
const std::string& fmt=
"%d");
44 std::string
int2str(
const size_t n);
53 const std::string& sep=
", ");
63 std::string
stripws(
const std::string& s);
79 std::string
lowercase(
const std::string& s);
105 const std::vector<std::string>& names=std::vector<std::string>());
115 int intValue(
const std::string& val);
124 doublereal
fpValue(
const std::string& val);
162 std::string
parseSpeciesName(
const std::string& nameStr, std::string& phaseName);
183 doublereal
strSItoDbl(
const std::string& strSI);
197 std::vector<std::string>& v);
205 size_t copyString(
const std::string& source,
char* dest,
size_t length);
Wrapper for either system-installed or local headers for fmt.
std::map< std::string, doublereal > compositionMap
Map connecting a string name with a double.
doublereal fpValue(const std::string &val)
Translate a string into one doublereal value.
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
std::string vec2str(const vector_fp &v, const std::string &fmt, const std::string &sep)
Convert a vector to a string (separated by commas)
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
std::string stripws(const std::string &s)
Strip the leading and trailing white space from a string.
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
void tokenizeString(const std::string &in_val, std::vector< std::string > &v)
This function separates a string up into tokens according to the location of white space...
std::string parseSpeciesName(const std::string &nameStr, std::string &phaseName)
Parse a name string, separating out the phase name from the species name.
size_t copyString(const std::string &source, char *dest, size_t length)
Copy the contents of a std::string into a char array of a given length.
std::string wrapString(const std::string &s, const int len)
Line wrap a string via a copy operation.
int intValue(const std::string &val)
Translate a string into one integer value.
compositionMap parseCompString(const std::string &ss, const std::vector< std::string > &names)
Parse a composition string into a map consisting of individual key:composition pairs.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Namespace for the Cantera kernel.
doublereal strSItoDbl(const std::string &strSI)
Interpret one or two token string as a single double.
std::string stripnonprint(const std::string &s)
Strip non-printing characters wherever they are.
doublereal fpValueCheck(const std::string &val)
Translate a string into one doublereal value, with error checking.