charon-core  0.3.1
StringTool Namespace Reference

Useful methods when working with strings.

Functions

std::string charon_core_DLL_PUBLIC combine (std::vector< std::string > strings, char delim=';')
 Combine a vector of strings to one string. More...
 
void charon_core_DLL_PUBLIC explode (std::string str, char delimiter, std::vector< std::string > &result)
 Use delimiter to split the string in a list of substrings. More...
 
std::string charon_core_DLL_PUBLIC toLowerCase (std::string s)
 Convert a string to lowercase. More...
 
std::string charon_core_DLL_PUBLIC trim (const std::string &s, const std::string &t=" \t\r\n")
 Remove (whitespace) characters from head and tail of a string. More...
 
std::string charon_core_DLL_PUBLIC trimLeft (const std::string &s, const std::string &t=" \t\r\n")
 Remove (whitespace) characters from the head of a string. More...
 
std::string charon_core_DLL_PUBLIC trimRight (const std::string &s, const std::string &t=" \t\r\n")
 Remove (whitespace) characters from the tail of a string. More...
 

Function Documentation

std::string StringTool::combine ( std::vector< std::string >  strings,
char  delim = ';' 
)
Parameters
stringsvector of string to combine
delimdelimiter
Returns
Combined string

Definition at line 61 of file StringTool.cpp.

void StringTool::explode ( std::string  str,
char  delimiter,
std::vector< std::string > &  result 
)
Parameters
strsource string
delimiterdelimiting character
resultlist containing the found substrings

Definition at line 46 of file StringTool.cpp.

std::string StringTool::toLowerCase ( std::string  s)
Parameters
sinput string
Returns
lowercase output string

Definition at line 55 of file StringTool.cpp.

std::string StringTool::trim ( const std::string &  s,
const std::string &  t = " \t\r\n" 
)
Parameters
ssource string
tcharacters to remove
Returns
modified string (copy)

Definition at line 41 of file StringTool.cpp.

References trimLeft(), and trimRight().

std::string StringTool::trimLeft ( const std::string &  s,
const std::string &  t = " \t\r\n" 
)
Parameters
ssource string
tcharacters to remove
Returns
modified string (copy)

Definition at line 36 of file StringTool.cpp.

std::string StringTool::trimRight ( const std::string &  s,
const std::string &  t = " \t\r\n" 
)
Parameters
ssource string
tcharacters to remove
Returns
modified string (copy)

Definition at line 27 of file StringTool.cpp.