Cantera  2.1.2
Namespaces | Functions
stringUtils.cpp File Reference

Contains definitions for string manipulation functions within Cantera. More...

#include "cantera/base/ct_defs.h"
#include "cantera/base/stringUtils.h"
#include "cantera/base/ctexceptions.h"
#include "cantera/base/global.h"
#include "cantera/base/ctml.h"
#include <sstream>
#include <cstdio>
Include dependency graph for stringUtils.cpp:

Go to the source code of this file.

Namespaces

 Cantera
 Namespace for the Cantera kernel.
 

Macros

#define SNPRINTF   snprintf
 

Functions

std::string fp2str (const double x, const std::string &fmt="%g")
 Convert a double into a c++ string. More...
 
std::string int2str (const int n, const std::string &fmt="%d")
 Convert an int to a string using a format converter. More...
 
std::string int2str (const size_t n)
 Convert an unsigned integer to a string. More...
 
std::string lowercase (const std::string &s)
 Cast a copy of a string to lower case. More...
 
static int firstChar (const std::string &s)
 Return the position of the first printable character in the string. More...
 
static int lastChar (const std::string &s)
 Return the position of the last printable character in the string. More...
 
std::string stripws (const std::string &s)
 Strip the leading and trailing white space from a string. More...
 
std::string stripnonprint (const std::string &s)
 Strip non-printing characters wherever they are. More...
 
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. More...
 
void split (const std::string &ss, std::vector< std::string > &w)
 Parse a composition string into individual key:composition pairs. More...
 
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. More...
 
std::string getBaseName (const std::string &fullPath)
 Get the file name without the path or extension. More...
 
int intValue (const std::string &val)
 Translate a string into one integer value. More...
 
doublereal fpValue (const std::string &val)
 Translate a string into one doublereal value. More...
 
doublereal fpValueCheck (const std::string &val)
 Translate a string into one doublereal value, with error checking. More...
 
std::string logfileName (const std::string &infile)
 Generate a logfile name based on an input file name. More...
 
std::string wrapString (const std::string &s, const int len=70)
 Line wrap a string via a copy operation. More...
 
std::string parseSpeciesName (const std::string &nameStr, std::string &phaseName)
 Parse a name string, separating out the phase name from the species name. More...
 
int stripLTWScstring (char str[])
 Routine strips off white space from a c character string. More...
 
doublereal strSItoDbl (const std::string &strSI)
 Interpret one or two token string as a single double. More...
 
static std::string::size_type findFirstWS (const std::string &val)
 Find the first white space in a string. More...
 
static std::string::size_type findFirstNotOfWS (const std::string &val)
 Find the first non-white space in a string. More...
 
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. More...
 
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. More...
 

Detailed Description

Contains definitions for string manipulation functions within Cantera.

Definition in file stringUtils.cpp.