27 trim(
const std::string & str,
const std::string & white_space =
" \t\n\v\f\r")
29 const auto begin = str.find_first_not_of(white_space);
30 if (begin == std::string::npos)
32 const auto end = str.find_last_not_of(white_space);
33 return str.substr(begin, end - begin + 1);
45 std::vector<T> & elements,
46 unsigned int min_len = 1,
47 const std::string & delims =
"/")
51 std::string::size_type last_pos = str.find_first_not_of(delims, 0);
52 std::string::size_type pos = str.find_first_of(delims,
std::min(last_pos + min_len, str.size()));
54 while (last_pos != std::string::npos)
56 elements.push_back(str.substr(last_pos, pos - last_pos));
58 last_pos = str.find_first_not_of(delims, pos);
59 if (last_pos == std::string::npos)
61 pos = str.find_first_of(delims,
std::min(last_pos + min_len, str.size()));
72 std::vector<T> & tokenized_vector,
73 const std::string &
delimiter =
" \t\n\v\f\r")
75 std::vector<std::string> tokens;
77 tokenized_vector.resize(tokens.size());
78 for (
unsigned int j = 0; j < tokens.size(); ++j)
80 std::stringstream ss(
trim(tokens[j]));
83 if ((ss >> tokenized_vector[j]).fail() || !ss.eof())
96 std::string upper(
name);
97 std::transform(upper.begin(), upper.end(), upper.begin(), ::toupper);
108 std::string lower(
name);
109 std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
std::string name(const ElemQuality q)
std::string toLower(const std::string &name)
Convert supplied string to lower case.
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
bool tokenizeAndConvert(const std::string &str, std::vector< T > &tokenized_vector, const std::string &delimiter=" \\\)
tokenizeAndConvert splits a string using delimiter and then converts to type T.
std::string trim(const std::string &str, const std::string &white_space=" \\\)
Standard scripting language trim function.
auto min(const L &left, const R &right)