Pixie16 Analysis Software Suite
Analysis code for processing of .ldf files
strings Namespace Reference

Some common string conversion operations. More...

Functions

double to_double (std::string s)
 
int to_int (std::string s)
 
bool to_bool (std::string s)
 
std::vector< std::string > tokenize (std::string str, std::string delimiter)
 

Detailed Description

Some common string conversion operations.

Function Documentation

bool strings::to_bool ( std::string  s)
inline

Converts string to bool (True, true, 1 and False, false, 0) are accepted; throws an exception if not succesful. Notice tolower will work only with ascii, not with utf-8, but shouldn't be a problem for true and false words.

Parameters
[in]s: String to convert to bool
Returns
A bool from the input string
double strings::to_double ( std::string  s)
inline

Converts string to double or throws an exception if not successful

Parameters
[in]s: String to convert to double
Returns
The double created from the string
int strings::to_int ( std::string  s)
inline

Converts string to int or throws an exception if not successful

Parameters
[in]s: string to convert to int
Returns
Integer made out of input string
std::vector<std::string> strings::tokenize ( std::string  str,
std::string  delimiter 
)
inline

Tokenizes the string, splitting it on a given delimiter. delimiters are removed from returned vector of tokens.

Parameters
[in]str: The string to break up
[in]delimiter: character to break up on
Returns
The vector of tokens