C++ Utils  0.1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
Static Public Member Functions
utils::StringUtils Class Reference

#include <stringutils.h>

List of all members.

Static Public Member Functions

static bool replace (std::string &str, const std::string &from, const std::string &to)
static bool replaceLast (std::string &str, const std::string &from, const std::string &to)
static bool startsWith (const std::string &str, const std::string &prefix)
static bool endsWith (const std::string &str, const std::string &suffix)
template<typename T >
static std::string toString (T value)
template<typename T >
static T parse (const std::string &str)
template<typename T >
static T parse (const std::string &str, bool adavanced)
template<typename T >
static std::vector< T > parseArray (const std::string &str)
static void toUpper (char *s)
static void toUpper (std::string &str)
static void toLower (char *s)
static void toLower (std::string &str)
static std::string & ltrim (std::string &s)
static std::string & rtrim (std::string &s)
static std::string & trim (std::string &s)
template<typename T >
static std::string join (const std::vector< T > &v, const std::string &token)
static std::vector< std::string > split (const std::string &str, char delim)

Detailed Description

A collection of useful string functions based on std::string


Member Function Documentation

static bool utils::StringUtils::endsWith ( const std::string &  str,
const std::string &  suffix 
) [inline, static]
template<typename T >
static std::string utils::StringUtils::join ( const std::vector< T > &  v,
const std::string &  token 
) [inline, static]
static std::string& utils::StringUtils::ltrim ( std::string &  s) [inline, static]
const char * utils::StringUtils::parse ( const std::string &  str) [inline, static]

Converts strings to arbitrary datatypes (using the << stream operator)

Parameters:
strThe string that should be converted
bool utils::StringUtils::parse ( const std::string &  str,
bool  adavanced 
) [inline, static]

Converts strings to arbitrary datatypes

Parameters:
strThe string that should be converted
advancedTrue of advanced conversions should be enabled
template<typename T >
static std::vector<T> utils::StringUtils::parseArray ( const std::string &  str) [inline, static]
static bool utils::StringUtils::replace ( std::string &  str,
const std::string &  from,
const std::string &  to 
) [inline, static]

Replaces first occurrence of from in str with to

Taken from http://stackoverflow.com/questions/3418231/c-replace-part-of-a-string-with-another-string

static bool utils::StringUtils::replaceLast ( std::string &  str,
const std::string &  from,
const std::string &  to 
) [inline, static]

Replaces last occurrence of from in str with to

static std::string& utils::StringUtils::rtrim ( std::string &  s) [inline, static]
static std::vector<std::string> utils::StringUtils::split ( const std::string &  str,
char  delim 
) [inline, static]
static bool utils::StringUtils::startsWith ( const std::string &  str,
const std::string &  prefix 
) [inline, static]
static void utils::StringUtils::toLower ( char *  s) [inline, static]

Converts null terminated string to lower case

static void utils::StringUtils::toLower ( std::string &  str) [inline, static]

Converts std::string to lower case

template<typename T >
static std::string utils::StringUtils::toString ( value) [inline, static]

Converts arbitrary datatypes (all datatypes which support the << stream operator) into std::string

static void utils::StringUtils::toUpper ( char *  s) [inline, static]

Converts null terminated string to upper case

static void utils::StringUtils::toUpper ( std::string &  str) [inline, static]

Converts std::string to upper case

static std::string& utils::StringUtils::trim ( std::string &  s) [inline, static]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines