Question about compare strings
ondrovic
Posts: 217
is there a way to compare multiple strings?
I guess what i am saying is if char is between char1 & char 2 do something if no do something else
Or is there a better way
If(char => Compare_String(char1,Char2) && var <= Compare_String(char3,char4) { do something } Else { do something }
I guess what i am saying is if char is between char1 & char 2 do something if no do something else
Or is there a better way
0
Comments
I'd compare the strings with the typical comparison operators < > == <>. Compare_String seems useless unless you want to use the ? wildcard, in which case it would be helpful. Highlight compare_string in your code and hit F1 for details.
What you want is I haven't actually tried to do this in NetLinx but it should work. If it doesn't then TYPE_CAST all these chars to INTEGER and it will definitely work.
Thanks Matt I will give that a try
Any ideas why the file isn't updating correctly?
Actually > and < work just fine this way. No need to do anything else. I do agree the time should be adjusted to 24 hour time.
IF (TIME > '01:00:00' and TIME < '13:00:00')
{
}
That's been an old programmers trick for some time. It just so happens that using a comparison like this is actually comparing the hex ascii value of the character which happens to work.
Somehow, I still don't like to do it. My main code always contains a little routine that converts the current time into decimal integer (seconds of the day. ex: 10,800= 3:00 AM)
I also convert the calendar day to Julian. It just makes creating and managing anything that schedules a lot more reliable and far fewer logic statements.
One should note, the reason this works is because the format returned by TIME has leading zeros. Otherwise, 2:00:00 > 11:00:00, etc.