Assignment Search Framework
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
string_utils.h File Reference

Go to the source code of this file.

Functions

std::string int_to_string (int i)
 
std::string double_to_string (double d)
 
void split (const std::string &s, std::vector< std::string > &tokens, char delim)
 
template<class T >
std::string vec_to_string (const std::vector< T > &vec)
 

Detailed Description

Utilities for string manipulation.

Function Documentation

std::string double_to_string ( double  d)

Converts the given double to a string.

Parameters
dThe double to convert.
Returns
The string representation of the double.
std::string int_to_string ( int  i)

Converts the given integer to a string.

Parameters
iThe integer to convert.
Returns
A string representation of the given integer.
void split ( const std::string &  s,
std::vector< std::string > &  tokens,
char  delim 
)

Splits the given string according into different tokens according to the given delimiter, and appends them to the given list.

Parameters
sThe string to split.
tokensThe list of tokens to store the split in.
delimThe delimiter.
template<class T >
std::string vec_to_string ( const std::vector< T > &  vec)

Returns a string representation of the given vector.

Assumes that the "<<" operator can be applied to the vector elements.

Parameters
vecA vector of elements.
Returns
A string representation of the vector.