pub fn replace<'a, T: Display>(
source: &'a str,
from: &'a str,
to: T,
) -> Replace<'a, T>
Expand description
Replace instances of the from
string with the to
Display object.
Note: this function, contrary to its std equivalent
str::replace
,
does not support the Pattern API because that API is not yet stabilized.
assert_eq!(replace("this is old", "old", "new").to_string(), "this is new");