Quantcast
Viewing all articles
Browse latest Browse all 3

Answer by Juan Campa for How do I remove line feeds / line breaks from std::string::String?

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


Viewing all articles
Browse latest Browse all 3

Trending Articles