std-method
String::remove
Delete the scalar beginning at idx and return it. The index must be inside the text and at a valid boundary; trailing bytes shift left. Expected stdout (not executed): ش AB Common mistake: Passing len() as the removal index.
Formal Syntax & Structure
rust syntaxrust
fn remove(&mut self, idx: usize) -> charWorking Example
Example Snippetrust
fn main() { let mut text = String::from("AشB"); let removed = text.remove(1); println!("{removed} {text}");}