3 The tracking issue for this feature is: [#32310]
5 [#32310]: https://github.com/rust-lang/rust/issues/32310
7 ------------------------
9 The `splice()` method on `Vec` and `String` allows you to replace a range
10 of values in a vector or string with another range of values, and returns
17 let mut s = String::from("α is alpha, β is beta");
18 let beta_offset = s.find('β').unwrap_or(s.len());
20 // Replace the range up until the β from the string
21 let t: String = s.splice(..beta_offset, "Α is capital alpha; ").collect();
22 assert_eq!(t, "α is alpha, ");
23 assert_eq!(s, "Α is capital alpha; β is beta");