I found this example for substring replacement:
use std::str; let string = \"orange\"; let new_string = str::replace(string, \"or\", \"str\");
There is no way in the standard library to do this; it’s a tricky thing to get right with a large number of variations on how you would go about doing it, depending on a number of factors. You would need to write such a function yourself.