| std::string syten::replace | ( | std::string const & | input, |
| std::string const & | start_delim, | ||
| std::string const & | end_delim, | ||
| T | func | ||
| ) |
Replaces occurences of delimited substrings by function return values.
Given a string input and two delimiter strings start_delim and end_delim, searches for all pairwise occurences of the delimiters, extracts the characters between them and calls the function func with those characters as argument, then replaces the delimiters plus internal content by the return value of the function.
Potentially expensive, only use for small strings or if function evaluations dominate.
| input | input string |
| start_delim | delimiter denoting the start of a replacee string |
| end_delim | delimiter denoting the end of a replacee string |
| func | function to call to get the replacer |
toupper a function taking a std::string and returning an all-uppercase version thereof results in a B c D E f} {g and a warning being thrown about a runaway argument. References std::string::find(), logGE(), std::string::size(), std::stringstream::str(), std::string::substr(), and SYTEN_ASSERT_MSG.
Here is the call graph for this function: