String replace all



examples/strings/replace/src/main.rs
fn main() {
    let text = String::from("Black cat, brown cat, many cats and a dog");
    println!("{text}");

    let new = text.replace("cat", "mouse");
    println!("{new}");
    println!("{text}");
}

Black cat, brown cat, many cats and a dog
Black mouse, brown mouse, many mouses and a dog
Black cat, brown cat, many cats and a dog