We have two separate instances running the same co...
# cfml-general
g
We have two separate instances running the same codebase. The code <cfif "12345-1" GT 0> resolves to true on one instance and false on another. Because it's a text string, is this a bad comparison?
d
Same CF version?
b
weird... trycf.com shows it working the same on all engines
g
It is the same CF version. Confirmed with Systems Admin.
d
Any chance of leading or trailing spaces on one server and not the other? If you mean to compare it as numbers, specifically integers, maybe throw in int() or val()? Of do a regex replace to keep only the digits.
g
There is a chance
I like what you're thinking here.
We can make them work the same by doing a ListGetAt(var,"-",1). Just curious if this was known behavior.
d
So something's different after the minus sign. Is the 1 not a one on one server, like maybe a lowercase L?
Can you just copy the code from one to the other?
This isn't your real question anyway I bet 🙂
g
Oh, they're definitely numeric. Good question, though.
a
is this a bad comparison?
It's bad code. Not sure if that's what you mean. Is "12345-1" an arithmetic expression in a string? Or is it like some sort of ID or something? What are you actually trying to test there?
💯 1
g
Thanks, Adam, we settled it that it is just bad code and we shouldn't be surprised when it fails to do what we want it to.
👍 1
a
Sorry to be blunt, but no-one else seemed to be asking "what are you actually trying to do here?" Still interested to understand that. Just out of interest.
g
What does Val around the string give you ?