Convert slices into String in Rust

I found it hard to find a single article to explain how to convert or merge slices to string in Rust. Here is an example of how to do it:

let row_content = &row.iter().map(|highscore| highscore.to_string()).collect::>().join(",");

I hope this helps someone who wants to concatenate slices/list in Rust into delimiter comma-separated string or only space.

Leave a Reply

Your email address will not be published. Required fields are marked *