summaryrefslogtreecommitdiff
path: root/remove-all-occurrences-of-a-substring/src/main.rs
blob: 8e1e18178b1436654116c8969e8399551706d539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
fn main() {
    println!("Hello, world!");
}

struct Solution;

impl Solution {
    pub fn remove_occurrences(mut s: String, part: String) -> String {
        while s.contains(&part) {
            s = s.replacen(&part, "", 1);
        }
        s
    }
}