Rivet: String utils

| Rivet 3.1.9

Classes | Functions
String utils

## Classes
struct | Rivet::bad_lexical_cast
| Exception class for throwing from lexical_cast when a parse goes wrong. More...

## Functions
template<typename T , typename U >
T | Rivet::lexical_cast (const U &in)
| Convert between any types via stringstream.
template<typename T >
string | Rivet::to_str (const T &x)
| Convert any object to a string.
template<typename T >
string | Rivet::toString (const T &x)
| Convert any object to a string.
string & | Rivet::replace_first (string &str, const string &patt, const string &repl)
| Replace the first instance of patt with repl.
string & | Rivet::replace_all (string &str, const string &patt, const string &repl)
| Replace all instances of patt with repl.
int | Rivet::nocase_cmp (const string &s1, const string &s2)
| Case-insensitive string comparison function.
bool | Rivet::nocase_equals (const string &s1, const string &s2)
| Case-insensitive string equality function.
string | Rivet::toLower (const string &s)
| Convert a string to lower-case.
string | Rivet::toUpper (const string &s)
| Convert a string to upper-case.
bool | Rivet::startsWith (const string &s, const string &start)
| Check whether a string start is found at the start of s.
bool | Rivet::endsWith (const string &s, const string &end)
| Check whether a string end is found at the end of s.
string | Rivet::strcat ()
template<typename T , typename... Ts>
string | Rivet::strcat (T value, Ts... fargs)
| Make a string containing the concatenated string representations of each item in the variadic list.
template<typename T >
string | Rivet::join (const vector< T > &v, const string &sep=" ")
| Make a string containing the string representations of each item in v, separated by sep.
template<>
string | Rivet::join (const vector< string > &v, const string &sep)
| Make a string containing the string representations of each item in v, separated by sep.
template<typename T >
string | Rivet::join (const set< T > &s, const string &sep=" ")
| Make a string containing the string representations of each item in s, separated by sep.
template<>
string | Rivet::join (const set< string > &s, const string &sep)
| Make a string containing the string representations of each item in s, separated by sep.
vector< string > | Rivet::split (const string &s, const string &sep)
| Split a string on a specified separator string.
string | Rivet::lpad (const string &s, size_t width, const string &padchar=" ")
| Left-pad the given string s to width width.
string | Rivet::rpad (const string &s, size_t width, const string &padchar=" ")
| Right-pad the given string s to width width.

## Detailed Description

## Function Documentation

## ◆ replace_all()

string & Rivet::replace_all | ( | string & | str,
|  | const string & | patt,
|  | const string & | repl
| ) |  |
| inline

Replace all instances of patt with repl.

Note
  Finding is interleaved with replacement, so the second search happens after first replacement, etc. This could lead to infinite loops and other counterintuitive behaviours if not careful.

References Rivet::contains().

## ◆ to_str()

template<typename T >

string Rivet::to_str | ( | const T & | x | ) |
| inline

Convert any object to a string.

Just a convenience wrapper for the more general Boost lexical_cast

Referenced by Rivet::VetoedFinalState::addVetoOnThisFinalState(), Rivet::join(), Rivet::join(), Rivet::FourMomentum::setPE(), and Rivet::FourMomentum::setPM().

## ◆ toString()

template<typename T >

string Rivet::toString | ( | const T & | x | ) |
| inline

Convert any object to a string.

An alias for to_str() with a more "Rivety" mixedCase name.