How to convert a string to an array of characters in Rust

1 Answer

0 votes
fn main() {
    let my_string = String::from("Rust");
    
    let char_array: Vec<char> = my_string.chars().collect();
    
    println!("{:?}", char_array);
}



/*
run:

['R', 'u', 's', 't']

*/

 



answered Apr 12 by avibootz
...