-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I really like your solution, but could not get it running on windows.
- \r\n is not supported and can not easily be implemented as the split requires one char only
- \r\n or \n can be at the end of the file, this breaks the logic.
I solved it like this:
// let d = include_bytes!("../input.txt");
let mut d_without_cr: Vec<u8> = input.into();
if d_without_cr.contains(&b'\r') {
d_without_cr.retain_mut(|it| *it != b'\r');
};
if d_without_cr.last().unwrap() == &b'\n' {
d_without_cr.pop();
}
let d = &d_without_cr[..];
I did not want to fork as this of course has a performance impact.
But might be worse mentioning in case any other later comers like me take a look :)
Best,
G.
Metadata
Metadata
Assignees
Labels
No labels