cpp-mate  0.7
Helpful library for C++.
CppMate::String Namespace Reference

Functions

std::string & trimBegin (std::string &str, const std::string &chars="\t\n\v\f\r ")
 Trims beginning of the string out of specified characters in place. More...
 
std::string & trimEnd (std::string &str, const std::string &chars="\t\n\v\f\r ")
 Trims ending of the string out of specified characters in place. More...
 
std::string & trim (std::string &str, const std::string &chars="\t\n\v\f\r ")
 Trims beginning and ending of the string out of specified characters in place. More...
 
std::string & replace (std::string &str, char oldCh, char newCh)
 Replaces all occurrences of specified character to another. More...
 
bool compareIgnoreCase (const std::string &str1, const std::string &str2)
 compareIgnoreCase More...
 
std::vector< std::string > split (const std::string &str, char ch, std::function< bool(std::string &)> preprocess=nullptr)
 Splits string by specifiet character. More...
 

Function Documentation

◆ compareIgnoreCase()

bool CppMate::String::compareIgnoreCase ( const std::string &  str1,
const std::string &  str2 
)

compareIgnoreCase

Parameters
str1
str2
Returns

◆ replace()

std::string& CppMate::String::replace ( std::string &  str,
char  oldCh,
char  newCh 
)

Replaces all occurrences of specified character to another.

Parameters
strthe string to process.
oldChexisting character.
newChreplace character.
Returns
string itself.

◆ split()

std::vector<std::string> CppMate::String::split ( const std::string &  str,
char  ch,
std::function< bool(std::string &)>  preprocess = nullptr 
)

Splits string by specifiet character.

Parameters
strthe string to split.
chcharacter as delimiter.
preprocessoptional preprocessor of each part.
Returns
string parts.

◆ trim()

std::string& CppMate::String::trim ( std::string &  str,
const std::string &  chars = "\t\n\v\f\r " 
)

Trims beginning and ending of the string out of specified characters in place.

Parameters
strthe string to trim.
charslist of characters to trim.
Returns
string itself.

◆ trimBegin()

std::string& CppMate::String::trimBegin ( std::string &  str,
const std::string &  chars = "\t\n\v\f\r " 
)

Trims beginning of the string out of specified characters in place.

Parameters
strthe string to trim.
charslist of characters to trim.
Returns
string itself.

◆ trimEnd()

std::string& CppMate::String::trimEnd ( std::string &  str,
const std::string &  chars = "\t\n\v\f\r " 
)

Trims ending of the string out of specified characters in place.

Parameters
strthe string to trim.
charslist of characters to trim.
Returns
string itself.