Skip to main content

replace_all

Function replace_all 

Source
pub fn replace_all(text: &str, term: &str, replacement: &str) -> (String, usize)
Expand description

Replaces every occurrence of term with replacement, reporting how many there were.

Occurrences are taken from the original text, so a replacement containing the term does not feed itself. Where matches overlap — aa in aaaa starts at 0, 1 and 2 — each replacement consumes its own characters and the matches reaching into it are passed over.