StringUtils Class Reference

#include <stringutils.h>

List of all members.

Static Public Member Functions

static int Split (const string input, const string delimiter, vector< string > &results)
static string mergeWords (vector< string > &words, const string separator)
static int toInt (const string input)
static float toFloat (const string input)
static string toString (const int input)
static string toString (const float input)
static string rmSpace (const string input)
static string rmTailSpace (const string input)
static string chomp (string inString)
static string slashToUnderscore (const string input)
static string field (string aString, int start, int maxlength)
static string fill (string aString, int aLength, string aChar=" ")
static string preFill (string aString, int aLength, string aChar=" ")
static string preFill (int anInt, int aLength, string aChar=" ")
static string preFill (float aFloat, int aLength, string aChar=" ")
static string getPath (string aLocation)
static string getExtension (string aLocation)
static string getNoExtension (string aLocation)
static string getFileName (string aLocation)
static string right (string aString, uint aLength)
static string toUpper (string aString)
static string toLower (string aString)
static string getFirstNonSpace (string aString)


Detailed Description

Static functions to be used to process strings

Author:
Dr Jean-Luc Perret (luc@kuicr.kyoto-u.ac.jp), Kyoto University, Japan
Version:
0.3
Date:
17 Jan 2004


Member Function Documentation

static string StringUtils::chomp (  string  inString  )  [static]
 

"chomp" the string, i.e., removes the last character if it is 'end of line'.

static string StringUtils::field (  string  aString,
int  start,
int  maxlength
)  [static]
 

returns the content of a field starting at position start and of length maxlength in string aString.

static string StringUtils::fill (  string  aString,
int  aLength,
string  aChar = " "
)  [static]
 

completes aString with aChar so that the total length is exactly equal to aLength. If aString is longer, it gets cropped.

static string StringUtils::getExtension (  string  aLocation  )  [static]
 

returns the extension of a file given a full path.

static string StringUtils::getFileName (  string  aLocation  )  [static]
 

returns the filename portion of a full path (including extension).

static string StringUtils::getFirstNonSpace (  string  aString  )  [static]
 

returns the string starting at the 1st non space character of aString.

static string StringUtils::getNoExtension (  string  aLocation  )  [static]
 

returns the path without extension.

static string StringUtils::getPath (  string  aLocation  )  [static]
 

returns the directory portion of a full path.

static string StringUtils::mergeWords (  vector< string > &  words,
const string  separator
)  [static]
 

merges words in a container< string >, inserting separator.

static string StringUtils::preFill (  float  aFloat,
int  aLength,
string  aChar = " "
)  [static]
 

prepends aChar to aFloat so that the total length is exactly equal to aLength. If aString is longer, it gets cropped.

static string StringUtils::preFill (  int  anInt,
int  aLength,
string  aChar = " "
)  [static]
 

prepends aChar to anInt so that the total length is exactly equal to aLength. If aString is longer, it gets cropped.

static string StringUtils::preFill (  string  aString,
int  aLength,
string  aChar = " "
)  [static]
 

prepends aChar to aString so that the total length is exactly equal to aLength. If aString is longer, it gets cropped.

static string StringUtils::right (  string  aString,
uint  aLength
)  [static]
 

returns aLength characters at the right end of aString.

static string StringUtils::rmSpace (  const string  input  )  [static]
 

removes all spaces in a string.

static string StringUtils::rmTailSpace (  const string  input  )  [static]
 

removes all tail spaces in a string.

static string StringUtils::slashToUnderscore (  const string  input  )  [static]
 

replaces slash by underscore in the string.

static int StringUtils::Split (  const string  input,
const string  delimiter,
vector< string > &  results
)  [static]
 

splits a string into a vector<string> using a string delimiter.

static float StringUtils::toFloat (  const string  input  )  [static]
 

transforms a string into a float using a stringstream.

static int StringUtils::toInt (  const string  input  )  [static]
 

transforms a string into an int using a stringstream.

static string StringUtils::toLower (  string  aString  )  [static]
 

converts aString to Lower case.

static string StringUtils::toString (  const float  input  )  [static]
 

transforms a float into an string using a stringstream.

static string StringUtils::toString (  const int  input  )  [static]
 

transforms a int into an string using a stringstream.

static string StringUtils::toUpper (  string  aString  )  [static]
 

converts aString to Upper case.


The documentation for this class was generated from the following file:
Generated on Wed Nov 28 12:12:52 2007 for ChemCpp by  doxygen 1.4.6