↧
Answer by Shepmaster for How do I remove line feeds / line breaks from...
First, you have to define what a "line feed" is. I choose the character \n. In that case, I'd just use replace: println!("{}", string.replace('\n', "")) This works for for &str and String. If you...
View ArticleHow do I remove line feeds / line breaks from std::string::String?
I cannot find something that will do this. What I have so far is only for whitespace: pub fn minify(&self) { println!("Minify task started ... "); let mut string_iter =...
View ArticleAnswer by Juan Campa for How do I remove line feeds / line breaks from...
You can now do this in-place with either of these two options:string.retain(|c| c != '\n')or (nightly only)string.remove_matches('\n');Check out this playground to see it working
View Article