Iterate over the characters of a string



examples/strings/iterate/src/main.rs
fn main() {
    let text = String::from("The black cat");
    println!("{text}");
    println!("{:?}", text.chars());

    for ch in text.chars() {
        println!("{ch}");
    }
}

The black cat
Chars(['T', 'h', 'e', ' ', 'b', 'l', 'a', 'c', 'k', ' ', 'c', 'a', 't'])
T
h
e
 
b
l
a
c
k
 
c
a
t