void syten::streamed_replace | ( | std::ostream & | out, |
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 and streams the result into the supplied output stream.
out | output stream into which data is written |
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
being written to the output stream and a warning about a runaway argument. References std::string::find(), std::flush(), logGE(), std::string::size(), std::string::substr(), and SYTEN_ASSERT_MSG.
Referenced by do_expval().