std-method
str::chars
Iterate over decoded Unicode scalar values. This is not a grapheme iterator. Expected stdout (not executed): A ش Common mistake: Treating every scalar as a full visible character.
Formal Syntax & Structure
rust syntaxrust
fn chars(&self) -> Chars<'_>Working Example
Example Snippetrust
fn main() { let text = "Aش"; for c in text.chars() { println!("{c}"); }}