pub trait ReplaceNewlinesWithSpace<'a> {
// Required method
fn replace_newlines_with_space(self) -> Cow<'a, str>;
}Available on crate feature
alloc only.Expand description
To extend str and Cow<str> to have replace_newlines_with_space method.
This can be useful when you need to normalize multiline strings into a single line for logging, database storage, or display purposes.
Required Methods§
Sourcefn replace_newlines_with_space(self) -> Cow<'a, str>
fn replace_newlines_with_space(self) -> Cow<'a, str>
Returns a Cow<str> where all newline sequences are replaced with a space.
Replaces Windows-style newlines (\r\n), old Mac-style (\r), and Unix-style (\n).