pub fn normalize_newlines(s: &str) -> String
Expand description
Replaces every U+000D U+000A pair of codepoints with a single U+000A codepoint, and any remaining U+000D codepoint with a U+000A codepoint.
See also: WHATWG Infra Standard definition
ยงExamples
use whatwg_infra::normalize_newlines;
let s = "\ralice\r\n\r\nbob\r";
assert_eq!(normalize_newlines(s), String::from("\nalice\n\nbob\n"));