7auto ltrim(
const std::string& str) -> std::string
9 auto str_modified = str;
14auto rtrim(
const std::string& str) -> std::string
16 auto str_modified = str;
21auto trim(
const std::string& str) -> std::string
23 auto str_modified = str;
28auto replace(
const std::string& str,
const std::string& search,
const std::string&
replace) -> std::string
30 auto str_modified = str;
35auto to_upper(
const std::string& str) -> std::string
37 auto str_modified = str;
42auto to_lower(
const std::string& str) -> std::string
44 auto str_modified = str;
51 auto str_modified = word;
56auto extract_substring(
const std::string& str,
const std::string& from,
const std::string& to) -> std::string
58 auto it_from = str.find(from);
59 if(it_from != std::string::npos)
61 auto result = str.substr(it_from + from.size(), std::string::npos);
62 auto it_to = result.find_first_of(to);
63 if(it_to != std::string::npos)
65 result = result.substr(0, it_to);
78 str.erase(str.begin(),
79 std::find_if(str.begin(),
83 return !std::isspace(ch);
89 str.erase(std::find_if(str.rbegin(),
93 return !std::isspace(ch);
105void replace(std::string& str,
const std::string& search,
const std::string&
replace)
113 while((pos = str.find(search, pos)) != std::string::npos)
115 str.replace(pos, search.length(),
replace);
122 std::transform(std::begin(str),
127 return std::toupper(c);
133 std::transform(std::begin(str),
138 return std::tolower(c);
149 str[0] =
static_cast<char>(std::toupper(
static_cast<unsigned char>(str[0])));
157 auto last_pos = str.find_first_not_of(delimiters, 0);
159 auto pos = str.find_first_of(delimiters, last_pos);
161 while(std::string::npos != pos || std::string::npos != last_pos)
164 tokens.emplace_back(str.substr(last_pos, pos - last_pos));
166 last_pos = str.find_first_not_of(delimiters, pos);
168 pos = str.find_first_of(delimiters, last_pos);
void rtrim(std::string &str)
void replace(std::string &str, const std::string &search, const std::string &replace)
void to_lower(std::string &str)
void capitalize(std::string &str)
void trim(std::string &str)
void to_upper(std::string &str)
void ltrim(std::string &str)
auto capitalize(const std::string &word) -> std::string
auto tokenize(const std::string &str, const std::string &delimiters) -> string_tokens_t
auto replace(const std::string &str, const std::string &search, const std::string &replace) -> std::string
auto extract_substring(const std::string &str, const std::string &from, const std::string &to) -> std::string
std::vector< std::string > string_tokens_t
auto to_lower(const std::string &str) -> std::string
auto trim(const std::string &str) -> std::string
auto ltrim(const std::string &str) -> std::string
auto to_upper(const std::string &str) -> std::string
auto rtrim(const std::string &str) -> std::string