StrUtil Class Reference
[Utils]

#include <StrUtil.h>

Collaboration diagram for StrUtil:

Collaboration graph
[legend]

List of all members.


Detailed Description

Helper class for operating on and with strings.

Definition at line 70 of file StrUtil.h.


Static Public Member Functions

static std::string trim (const std::string &s)
 trim whitespace from the front and back of strings
static std::string trimFront (const std::string &s)
 trim whitespace from the front of the string
static std::string trimBack (const std::string &s, char c)
 trim whitespace from the back of the string
static std::string toLower (std::string s)
 convert all characters to lowercase
static std::string toUpper (std::string s)
 convert all characters to uppercase
static std::string replaceAll (std::string src, const std::string &target, const std::string &replacement)
 replace all occurrences of target in src with replacement
static size_t readLine (std::string &src, std::string &dst)
 reads a line terminated with
static size_t read (std::string &src, std::string &dst, size_t n)
 reads from src into dest n bytes
static bool matches (const std::string &regexp, const std::string &s, bool ignoreCase=false, bool matchNewline=false) throw (RegexException)
 matches string s against regular expression regexp
static StringList match (const std::string &regexp, const std::string &s, bool ignoreCase=false, bool matchNewline=false) throw (RegexException)
static bool match (const std::string &regexp, const std::string &s, StringList &matchList, bool ignoreCase=false, bool matchNewline=false) throw (RegexException)
static std::string translatePerlRE (std::string re)
 translates a perl regular expression into a regex regular expression
static void toCStr (const StringList &l, const char *a[])
static StringList split (const std::string &delim, std::string s, bool returnEmpty=false)
 splits string s on delimiter delim, optionally returning empty elements
static std::string join (const std::string &delim, const StringList &l)
 joins string list l using delimiter delim
static bool isPrintable (const std::string &s)
 returns true if the string contains only printable characters
static std::string spaces (size_t w, size_t l)
template<typename T>
static mace::string toString (T v)
 convert arbirtary types T to string, using boost::lexical_cast
template<typename T>
static bool isType (const std::string &s)
 uses boost::lexical_cast to try to convert a string to an arbitrary type, returning true if it can
template<typename T>
static bool tryCast (const std::string &s, T &v)
 uses boost::lexical_cast to try to convert a string to an arbitrary type, storing in v, returning true if it can

Member Function Documentation

static size_t StrUtil::readLine ( std::string &  src,
std::string &  dst 
) [static]

reads a line terminated with

'\n' 
or
'\r\n' 
from src into dst, returns number of bytes extracted from src

static StringList StrUtil::match ( const std::string &  regexp,
const std::string &  s,
bool  ignoreCase = false,
bool  matchNewline = false 
) throw (RegexException) [static]

Todo:
JWA please document

static bool StrUtil::match ( const std::string &  regexp,
const std::string &  s,
StringList matchList,
bool  ignoreCase = false,
bool  matchNewline = false 
) throw (RegexException) [static]

Todo:
JWA please document

void StrUtil::toCStr ( const StringList l,
const char *  a[] 
) [static]

Todo:
JWA please document

Definition at line 262 of file StrUtil.cc.

References mace::deque< T, Serial, Alloc >::size().

string StrUtil::spaces ( size_t  w,
size_t  l 
) [static]

Todo:
JWA please document

Definition at line 320 of file StrUtil.cc.


The documentation for this class was generated from the following files:

Generated on Sat Oct 4 21:30:30 2008 for Mace Library by  doxygen 1.5.5