Skip to content
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

Issue with CRLF in string.contains() #653

Closed
22ispencer opened this issue Jul 2, 2024 · 2 comments
Closed

Issue with CRLF in string.contains() #653

22ispencer opened this issue Jul 2, 2024 · 2 comments

Comments

@22ispencer
Copy link

I am learning gleam, and to do this i am doing the advent of code 2023, however because i'm on windows line endings are CRLF by default, when i try to parse my string i created a function to split a string by lines and i tried to use string.contains(input, "\r") however this is returning false even though the io.debug print of the string contains "\r\n".

@22ispencer
Copy link
Author

upon further investigation it does work when i use string.contains(input, "\r\n"), which seems counter intuitive, could anyone explain why?

@lpil
Copy link
Member

lpil commented Jul 5, 2024

\r\n is a single grapheme. The JavaScript version however has a bug in which it does not correctly handle the unicode here and splits it in half: #584

@lpil lpil closed this as not planned Won't fix, can't repro, duplicate, stale Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants