Page 1 of 1

Comparing strings

Posted: Tue May 06, 2008 10:12 am
by vidor
Hi all,

I want to compare two strings: ID_RX[] = ID_string[].
Both are two digits long. 01 to 99.
I tried with: ID_RX[0] = ID_string[0] AND ID_RX[1] = ID_string[1] in a Decision box, but is not working.
I tried with: ID_RX[Index] = ID_string[Index] but the result is the same, not working.
It would be a solution to compare the first digit when it comes through RS232, and the second after that.
I wanted, to read in the two digits and compare after.
Is there any solution?
Thanks in advance
Regards
Vidor

Re: Comparing strings

Posted: Tue May 06, 2008 10:31 am
by Steve
Try this:

Code: Select all

(ID_RX[0] = ID_string[0]) && (ID_RX[1] = ID_string[1])
The word "AND" is used for a bitwise-And, not a logical-And.

Re: Comparing strings

Posted: Tue May 06, 2008 10:47 am
by vidor
Thank you Steve, now it works fine.
Best regards
Vidor