Stride Reference Manual  1.0
stride::util::StringUtils Class Reference

String utilities. More...

#include <StringUtils.h>

Collaboration diagram for stride::util::StringUtils:
Collaboration graph

Static Public Member Functions

template<typename T >
static T fromString (std::string const &s)
 Builds a value of type T representation from a string. More...
 
static std::vector< std::string > split (const std::string &str, const std::string &delimiters)
 Split a string (in order of occurence) by splitting it on the given delimiters. More...
 
static std::vector< std::string > tokenize (const std::string &str, const std::string &delimiters)
 Tokenize a string (in order of occurence) with the given delimiters. More...
 
template<typename T >
static std::string toString (T const &value)
 Builds a string representation of a value of type T. More...
 
template<typename T >
static std::string toString (T const &value, int width, char fill= ' ')
 Builds a string representation with minimum width of a value of type T. More...
 
static std::string toLower (std::string const &source)
 Builds a string with lower case characters only. More...
 
static std::string toUpper (std::string const &source)
 Builds a string with upper case characters only. More...
 
static std::string trimRight (std::string const &source, std::string const &t=" ")
 Trim characters at right end of string. More...
 
static std::string trimLeft (std::string const &source, std::string const &t=" ")
 Trim characters at left end of string. More...
 
static std::string trim (std::string const &source, std::string const &t=" ")
 Trim characters at both ends of string. More...
 
static std::string replace (std::string source, std::string from, std::string to)
 Replace all occurences of a string with another. More...
 

Detailed Description

String utilities.

Definition at line 37 of file StringUtils.h.

Member Function Documentation

template<typename T >
static T stride::util::StringUtils::fromString ( std::string const &  s)
inlinestatic

Builds a value of type T representation from a string.

Definition at line 41 of file StringUtils.h.

static std::vector<std::string> stride::util::StringUtils::split ( const std::string &  str,
const std::string &  delimiters 
)
inlinestatic

Split a string (in order of occurence) by splitting it on the given delimiters.

Definition at line 49 of file StringUtils.h.

Referenced by stride::PopulationBuilder::build(), stride::SimulatorBuilder::initializeDistricts(), stride::SimulatorBuilder::initializeLocations(), and stride::run::Runner::Runner().

static std::vector<std::string> stride::util::StringUtils::tokenize ( const std::string &  str,
const std::string &  delimiters 
)
inlinestatic

Tokenize a string (in order of occurence) with the given delimiters.

Multiple consecutive delimiters do NOT define "empty" tokens; they are simply skipped.

Definition at line 58 of file StringUtils.h.

template<typename T >
static std::string stride::util::StringUtils::toString ( T const &  value)
inlinestatic

Builds a string representation of a value of type T.

Definition at line 80 of file StringUtils.h.

template<typename T >
static std::string stride::util::StringUtils::toString ( T const &  value,
int  width,
char  fill = ' ' 
)
inlinestatic

Builds a string representation with minimum width of a value of type T.

Definition at line 88 of file StringUtils.h.

static std::string stride::util::StringUtils::toLower ( std::string const &  source)
inlinestatic

Builds a string with lower case characters only.

Definition at line 95 of file StringUtils.h.

Referenced by stride::util::InstallDirs::initialize().

static std::string stride::util::StringUtils::toUpper ( std::string const &  source)
inlinestatic

Builds a string with upper case characters only.

Definition at line 103 of file StringUtils.h.

static std::string stride::util::StringUtils::trimRight ( std::string const &  source,
std::string const &  t = " " 
)
inlinestatic

Trim characters at right end of string.

Definition at line 111 of file StringUtils.h.

Referenced by trim().

static std::string stride::util::StringUtils::trimLeft ( std::string const &  source,
std::string const &  t = " " 
)
inlinestatic

Trim characters at left end of string.

Definition at line 117 of file StringUtils.h.

Referenced by trim().

static std::string stride::util::StringUtils::trim ( std::string const &  source,
std::string const &  t = " " 
)
inlinestatic

Trim characters at both ends of string.

Definition at line 123 of file StringUtils.h.

References trimLeft(), and trimRight().

Referenced by stride::run::Runner::Runner().

static std::string stride::util::StringUtils::replace ( std::string  source,
std::string  from,
std::string  to 
)
inlinestatic

Replace all occurences of a string with another.

Definition at line 129 of file StringUtils.h.

Referenced by stride::run::Runner::Runner().


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