Tomy Saman
08/09/2024, 4:35 AMTomy Saman
08/09/2024, 4:38 AMTomy Saman
08/09/2024, 4:38 AMTomy Saman
08/09/2024, 4:39 AMTomy Saman (Wu)
08/09/2024, 11:42 AMTomy Saman (Wu)
08/09/2024, 12:10 PMTomy Saman (Wu)
08/09/2024, 12:11 PMTomy Saman (Wu)
08/09/2024, 1:00 PMaliaspooryorik
echo( char(383) == "S" )
denny
08/09/2024, 1:33 PMresult = Replace(test, "#chr(383)#", "_", "all");https://trycf.com/gist/c3f61f154fafe0ccab4c7e1940d6e4c0/lucee5?theme=monokai
denny
08/09/2024, 1:33 PMdenny
08/09/2024, 1:36 PMdenny
08/09/2024, 1:40 PMdenny
08/09/2024, 1:43 PMTomy Saman (Wu)
08/09/2024, 2:17 PMjclausen
08/10/2024, 5:56 PMdenny
08/10/2024, 11:10 PMdenny
08/10/2024, 11:12 PMTomy Saman (Wu)
08/11/2024, 12:14 AMTomy Saman (Wu)
08/11/2024, 12:16 AMdenny
08/11/2024, 12:18 AMdenny
08/11/2024, 12:22 AMdenny
08/11/2024, 11:07 PM"S" == "s"
should be considered a bug 😜denny
08/11/2024, 11:16 PMdenny
08/11/2024, 11:27 PMTomy Saman
08/12/2024, 10:50 PMasc(test_S) == asc(test_s) --> true
this is my bad, I was naming the variable test_S
and test_s
thinking CF supports case-sensitive variables.
But "s" == "S" --> true
is new to me. I have always thought string equality test is case sensitive and always do this lcase(var1) eq lcase(var2)
😅 Guess I should always test, don't assume, even as simple as thisdenny
08/13/2024, 12:52 AMdenny
08/13/2024, 12:59 AM==
in CF (history!) as it came from eq
, which wasn't exactly what other languages would think of as ==
, if that makes sense.denny
08/13/2024, 1:01 AM'S' === 's'
to get what you would expect. (for some definition of expect, lol)denny
08/13/2024, 1:07 AM'S' === 's'
but ACF (from 2018, when they added it (after Lucee), IIRC) says truedenny
08/13/2024, 1:07 AM====
🤪Adam Cameron
compare
and compareNoCase
which has been the recommended way of comparing strings where casing matters. CFML has always been positioned as a case-insensitive language, so there should be no surprises that the equality operators behave that way.
As for ===
behaviour, I believe Lucee's implementation is bugged in its design (as well as its incompat with CF) in that it's doing an identity check, not following the CFML rules which is "check type then check value", where in the case of strings "check value" is case-insensitive.
Compare:
https://trycf.com/gist/f66fdce2282956978e67f50edf9ac430/lucee5?theme=monokai
When using string literals, the strings will equal due to how Java stores string instances; but if the values are created dynamically, ===
is no help to you.denny
08/14/2024, 5:06 PM====
not so funny (like what would be a shorthand for stricter-strict equality?)
There's a reason JS added ===
, and I think it's the same reason CF needed it (dynamic types), so of the two implementations I'd take Lucee's, as it's closer to filling the actual need.denny
08/14/2024, 5:25 PM