pub fn to_lf_crlf(s: &str) -> (Cow<'_, str>, Option<Cow<'_, str>>)
Expand description
Convert a string to both LF and CRLF if it contains a newline.
ยงExamples
assert_eq!(
to_lf_crlf("abc\ndef\nghi"),
("abc\ndef\nghi".into(), Some("abc\r\ndef\r\nghi".into()))
);
assert_eq!(
to_lf_crlf("12\r\n34\r\n56\r\n78"),
("12\n34\n56\n78".into(), Some("12\r\n34\r\n56\r\n78".into()))
);
assert_eq!(
to_lf_crlf("abc123"),
("abc123".into(), None),
);