
adccommunitymod (AutomationDirect) asked a question.
Basic module String compare.
Created Date: March 18,2002
Created By: doodle
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
I'm receiving RS232 with a basic module and am trying to compare the input string to another string. for instance - 10 Input2 ,$(0) 20 If $(0) = "0504 " then whatever.. This isn't working - it seems to ignore the "04 " portion of the data. Question is what do I convert a string to when comparing? Help!
Created Date: March 18,2002
Created by: doodle
I'm receiving RS232 with a basic module and am trying to compare the input string to another string.
for instance -
10 Input2 ,$(0)
20 If $(0) = "0504 " then whatever..
This isn't working - it seems to ignore the "04 " portion of the data.
Question is what do I convert a string to when comparing?
Help!
Created Date: March 19,2002
Created by: MacS
You need to use the INSTR statement to do full string compares.
Change line 20 to
20 IF INSTR($(0), "0504 ") THEN whatever
If the patterrn string ( "0504 ") is found in the search string ($(0)) the IF statement will be true.