pub trait StringExt {
// Required method
fn crlf_suppressor_string(self) -> String;
}
Expand description
Additional method for String
suppressing \r
in \r\n
sequences:
When no \r\n
is found, no memory allocation occurs.
use tpnote_lib::text_reader::StringExt;
let s = "hello\r\nworld".to_string();
let res = s.crlf_suppressor_string();
assert_eq!("hello\nworld", res);
let s = "hello\nworld".to_string();
let res = s.crlf_suppressor_string();
assert_eq!("hello\nworld", res);