How to convert a string to a vector of chars in Rust

1 Answer

0 votes
fn main() {
    let my_string = String::from("Rust Programming");
    
    let char_vector: Vec<char> = my_string.chars().collect();

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




/*
run:

['R', 'u', 's', 't', ' ', 'P', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g']

*/

 



answered Nov 1 by avibootz
...