-
Notifications
You must be signed in to change notification settings - Fork 3.4k
(str == <<>>)
Results in false for empty strings in comprehensions
#13673
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
Comments
These are actually non-empty strings, they contain this invisible separator codepoint: s = ""
String.length(s) # 1
String.to_charlist(s) # [8291]
Integer.to_string(8291, 16) # "2063"
s == "\u2063" # true |
Closing this as there is no bug in Elixir, but we may want to improve the printing in Elixir to make these cases clearer. :) |
[notes] By comparison in python:
|
sabiwara
added a commit
to sabiwara/elixir
that referenced
this issue
Jun 19, 2024
This reduces confusion when working with zero-width characters or alternative spaces. Relates to elixir-lang#13673
sabiwara
added a commit
that referenced
this issue
Jun 19, 2024
) This reduces confusion when working with zero-width characters or alternative spaces. Relates to #13673
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Elixir and Erlang/OTP versions
elixir 1.14.5-otp-25
erlang 25.0.4
Operating system
MacOS Sonoma 14.5 (23F79)
Current behavior
The following function:
For the string:
Produces results:
Which is not correct since both strings are empty, so they should both return
true
for the checkstr == <<>>
Expected behavior
The function should produce:
For those empty strings
The text was updated successfully, but these errors were encountered: