pub fn normalise_newlines(orig: &str) -> StringExpand description
Normalise newlines by replacing any \n with \r\n.
ยงExamples
// These inputs return the same value unchanged:
assert_eq!(normalise_newlines("hello\r\nworld"), "hello\r\nworld");
assert_eq!(normalise_newlines("hello\r\r\nworld"), "hello\r\r\nworld");
assert_eq!(normalise_newlines("hello\rworld"), "hello\rworld");
assert_eq!(normalise_newlines("hello\r\nworld\r\n"), "hello\r\nworld\r\n");
// These add a missing \r:
assert_eq!(normalise_newlines("hello\nworld"), "hello\r\nworld");
assert_eq!(normalise_newlines("hello\r\nworld\n"), "hello\r\nworld\r\n");