Is there a simple way to generate the lowercase and uppercase English alphabet in Rust?

Viewed 5354

This is what I'm doing so far:

fn main() {
    let a = (0..58).map(|c| ((c + 'A' as u8) as char).to_string())
                       .filter(|s| !String::from("[\\]^_`").contains(s) )
                       .collect::<Vec<_>>();    

    println!("{:?}", a);
}

Output is:

["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

Also no crates if possible.

5 Answers
for alphabet in 'a'..='z' {
println!("{}", alphabet );
}

It prints all the alphabets in lower case.

Related