Bug in Control with Comparison Int/String

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
2 posts • Page 1 of 1
ChristianGoehring
Posts:14
Joined: Fri Feb 24, 2017 9:29 am

Bug in Control with Comparison Int/String

Post by ChristianGoehring »

There is a bug with the comparison operator between two variables of types "int" and "string".

This happens if the string number is two-digit.

Reproduce:

"10" > 9 is false.
9 < "10" is false.

If both are two-digit or both are one-digit it works:

"11" > 10 is true.
10 < "11" is true.
"9" > "8" is true.
"8" < "9" is true.

gschijndel
Posts:376
Joined: Tue Jan 15, 2019 3:12 pm

Re: Bug in Control with Comparison Int/String

Post by gschijndel »

It just seems to me that the int is converted to a string for the comparison, which is not what you expected.
Some say it is good practice to avoid implicit castings to prevent such confusion.

Does it work with an explicit cast to int?

2 posts • Page 1 of 1