newline-converter
is a simple library used for converting the newline characters in strings between Windows \r\n
and Unix \n
style. It mainly serves as a backend for Rust Newline converter CLI tool.
\r
characters. For example, \r\n
sequences won't become \r\r\n
after unix2dos
call:
rust
use newline_converter::unix2dos;
assert_eq!(
unix2dos("\nfoo\r\nbar\n"),
"\r\nfoo\rbar\n"
);
unix2dos
) when dealing with larger data sets (ex. 100 paragraphs of Lorem Ipsum).string.replace
unix2dos
.Regex::replace_all
unix2dos
, because of lack of support for look around.Regex::replace_all
unix2dos
has worst performance of all implementations, by an order of magnitude (because of look around used).Look into benches/bench.rs
for the comparision benchmarks.
Minimum Supported Rust Version is 1.38.0
.