-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRLF vs LF issue for input str #59
Comments
can you please post the regex you are using? |
Yea sure If we take this regex expression
It won't work on CRLF mode because I am using |
I also noticed something else which I feel like should be taken care of, all the inputs have an extra empty line at the end which is really not needed when passing it in the code, should we also trim the input str before passing it down to the solution functions |
thank you for the details. are these issues also present when you use aoc-cli directly to download the input? sorry for the questions, I don't have access to a windows machine atm. |
The issue with crlf is present in the examples folder only not the input folder files. Actually now that I think of it, its possible that its the git setting that makes that happen. But still the str should not contain the extra character in that case as well. The extra line issue occurs in the input folder generated by aoc cli |
Do you think it would be an ideal solution to just replace all Happy to make a pr for the same |
The input files downloaded from the AOC website have a final trailing newline as well. I think we should not alter the input files and leave the line.
tbh I'm not sure what / if we can to do something about the CLRF line endings. |
Before the input is passed onto the |
I would appreciate if we can focus this issue on the CLRF / LF topic. |
makes sense, so still for the CRLF / LF, I don't see any other option working for us immediately other than to replace |
Checkout |
The problem is the regex being used is for multiple lines/the entire input. Hence it also has |
You can also setup you IDE and git to use |
some further context on the regex crate & CRLF: rust-lang/regex#244 |
Oh, I didn't know that existed, I just started learning rust with aoc this year. Thanks a lot. Sorry for the trouble |
If your IDE defaults to using CRLF instead of LF, which generally happens in Windows, the input str has an extra character at the end on all lines except the last one.
Like in the image, line 1 shows a length of
22
while it's21
, and line 2 shows the correct length as it is the last. It would be nice to see this template handle that issue as it causes regex expressions using\n
to not work properly.The text was updated successfully, but these errors were encountered: