StringUtil Class Reference

List of all members.

Static Public Member Functions

static std::string Strip (const std::string &s, const char &x= '\0')
 String utilities.
static std::string StripNull (const std::string &s)
 Strip out null characters from string.
static std::string Trim (const std::string &s)
 Trim off leading & trailing spaces from string.
static std::string CentreString (const std::string &text, const int &fieldwidth, const int &cenpos=0)
 Return string of length <fieldwidth> with text centred on position cenpos in it.
static std::string PadString (const std::string &text, const int &fieldwidth)
 Return string of length Max(fieldwidth, Length(text)).
static std::string RightString (const std::string &text, const int &fieldwidth)
 Return right-justified string.
static std::string LeftString (const std::string &text, const int &fieldwidth)
 Return left-justified string.
static std::vector< std::string > split (const std::string &str, const std::string &sep)
 Return substrings split at string "sep" (excluded).
static std::vector< std::string > split (const std::string &str, const std::string &sep1, const std::string &sep2)
 Return substrings split at string "sep1" or "sep2" (excluded).
static std::string MakeXMLtag (const std::string &tag, const std::string &data)
 make XML tag <tag><data</tag>
static std::string ftos (const float f, const int w, const int d)
 fixed point float to string conversion (w.df)
static std::string etos (const float f, const int w, const int d)
 floating point float to string conversion (w.df)
static std::string ftos (const double f, const int w, const int d)
 fixed point double to string conversion (w.df)
static std::string etos (const double f, const int w, const int d)
 floating point double to string conversion (w.df)
static std::string WrapLine (const std::string &line, const int &pagewidth, const int &nindent, const std::string &sepc=" ")
 returns wrapped line with indent
static std::string formatFraction (const double &fr, const int &width)
 Format a real number as a fraction ie "n/m".
static std::string ToUpper (const std::string &s)
 returns uppercase version of string
static std::string BuftoLine (const std::string buf)
 Extract line from buffer, removing any trailing Cr or Lf characters.
static std::string FormatSaveVector (const std::vector< int > ivec)
 format integer vector for dump/save
static std::string FormatSaveVector (const std::vector< double > vec)
 format real vector for dump/save

Member Function Documentation

std::string StringUtil::CentreString ( const std::string &  text,
const int &  fieldwidth,
const int &  cenpos = 0 
) [static]

Return string of length <fieldwidth> with text centred on position cenpos in it.

If string length is > fieldwidth, return full string

std::string StringUtil::formatFraction ( const double &  fr,
const int &  width 
) [static]

Format a real number as a fraction ie "n/m".

Parameters:
fr number of format
width field width for decimal version, if fail to find suitable fraction
Parameters:
width Format a real number as a fraction ie "n/m"
std::string StringUtil::Strip ( const std::string &  s,
const char &  x = '\0' 
) [static]

String utilities.

Strip out space and x characters from string

std::string StringUtil::ToUpper ( const std::string &  s  )  [static]

returns uppercase version of string

Parameters:
fr number of format
width field width for decimal version, if fail to find suitable fraction
Parameters:
s returns uppercase version of string
std::string StringUtil::WrapLine ( const std::string &  line,
const int &  pagewidth,
const int &  nindent,
const std::string &  sepc = " " 
) [static]

returns wrapped line with indent

Parameters:
line line to wrap
pagewidth number of characters in wrapped line (may run over at end)
indent indent lines after first by this number of items in 1st line
sepc terminator for item, default space, included if not space

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Friends
Generated on Tue Mar 1 11:22:28 2011 for Pointless by  doxygen 1.6.3