std-method

String::pop

Remove the final Unicode scalar value if present. A multi-byte scalar is removed completely, but a grapheme can contain more than one scalar. Expected stdout (not executed): ش A Common mistake: Assuming pop removes a complete visual character cluster.

Formal Syntax & Structure

rust syntaxrust
fn pop(&mut self) -> Option<char>

Working Example

Example Snippetrust
fn main() {    let mut label = String::from("Aش");    println!("{}", label.pop().unwrap());    println!("{label}");}
Rust Reference