7 #ifndef CT_STRINGUTILS_H
8 #define CT_STRINGUTILS_H
25 std::string
fp2str(
const double x,
const std::string& fmt=
"%g");
32 std::string
int2str(
const int n,
const std::string& fmt=
"%d");
38 std::string
int2str(
const size_t n);
48 std::string
stripws(
const std::string& s);
64 std::string
lowercase(
const std::string& s);
89 const std::vector<std::string>& names);
98 void split(
const std::string& ss, std::vector<std::string>& w);
109 const char delim =
' ');
118 std::string
logfileName(
const std::string& infile);
127 std::string
getBaseName(
const std::string& fullPath);
138 int intValue(
const std::string& val);
148 doublereal
fpValue(
const std::string& val);
187 std::string
parseSpeciesName(
const std::string& nameStr, std::string& phaseName);
224 doublereal
strSItoDbl(
const std::string& strSI);
238 std::vector<std::string>& v);
241 void copyString(
const std::string& source,
char* dest,
size_t length);
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.
void split(const std::string &ss, std::vector< std::string > &w)
Parse a composition string into individual key:composition pairs.
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
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 getBaseName(const std::string &path)
Get the file name without the path or extension.
std::string stripws(const std::string &s)
Strip the leading and trailing white space from a string.
std::string logfileName(const std::string &infile)
Generate a logfile name based on an input file name.
int stripLTWScstring(char str[])
Routine strips off white space from a c character string.
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
void tokenizeString(const std::string &oval, std::vector< std::string > &v)
This function separates a string up into tokens according to the location of white space...
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.
int fillArrayFromString(const std::string &str, doublereal *const a, const char delim)
Interpret a string as a list of floats, and convert it to a vector of floats.
std::string parseSpeciesName(const std::string &nameStr, std::string &phaseName)
Parse a name string, separating out the phase name from the species name.
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.
void 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.
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.