NASA - Jet Propulsion Laboratory
    + View the NASA Portal
Search JPL
Jet Propulsion Laboratory Home Earth Solar System Stars & Galaxies Technology
Introduction Background Software Links

String handling helper functions


Functions

std::string trim (const std::string &orig)
template<typename T>
std::string dataToString (const T &x)
std::string intToString (int x, int width)
template<typename T>
void stringToData (const std::string &x, T &value)
template<typename T>
stringToData (const std::string &x)
void parse_file (const std::string &filename, std::map< std::string, std::string > &dict)
bool equal_nocase (const std::string &a, const std::string &b)
std::string tolower (const std::string &input)

Detailed Description


Function Documentation

std::string trim ( const std::string &  orig  ) 

Returns the string orig without leading and trailing whitespace.

template<typename T>
std::string dataToString ( const T &  x  )  [inline]

Returns a string containing the text representation of x.

Care is taken that no information is lost in the conversion.

Definition at line 86 of file cxxutils.cc.

std::string intToString ( int  x,
int  width 
)

Returns a string containing the text representation of x, padded with leading zeroes to width characters.

Definition at line 121 of file cxxutils.cc.

template<typename T>
void stringToData ( const std::string &  x,
T &  value 
) [inline]

Reads a value of a given datatype from a string.

template<typename T>
T stringToData ( const std::string &  x  )  [inline]

Reads a value of a given datatype from a string.

Definition at line 224 of file cxxutils.h.

void parse_file ( const std::string &  filename,
std::map< std::string, std::string > &  dict 
)

Parses the file filename and returns the key/value pairs in dict.

bool equal_nocase ( const std::string &  a,
const std::string &  b 
)

Case-insensitive string comparison.

Returns true, if a and b differ only in capitalisation, else false.

std::string tolower ( const std::string &  input  ) 

Returns lowercase version of input.


Generated on Fri Jun 18 16:12:29 2010 for LevelS C++ support library
Privacy / Copyright
FIRST GOV Contact: NASA Home Page Site Manager:
Webmaster:

CL 03-2650