2 ms·
Rust uses very similar API to other languages for this: https://doc.rust-lang.org/std/string/struct.String.html#method.replace_range https://doc.rust-lang.org/
by jessegrosjean 6y ago
Rust uses very similar API to other languages for this:
https://doc.rust-lang.org/std/string/struct.String.html#method.replace_range https://doc.rust-lang.org/std/string/struct.String.html#meth...
The problems you are likely running into are higher level mutability issues. The above linked function requires &mut self, which means you need a mutable string. The above linked documentation has an example of using the `mut` keyword to declare a mutable string that you can replace_range on.