Map the split to trim each entry
Advertisements I need to write a function that takes a string as an input, splits it by the line break character and trims all the redundant break characters in each entry of the split. I’ve come up with the following: fn split_and_trim(text: &String) { let lines – text.split(‘\n’).map(|l| String::from(l).trim()); println!("{:?}", lines) } But this code… Read More Map the split to trim each entry