String compare function

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
henker
Posts: 45
Joined: Mon Dec 22, 2008 11:22 pm
Location: Prospect, NS, Canada
Has thanked: 7 times
Been thanked: 2 times

String compare function

Post by henker »

Hello

Trying to figure out why the "string Compare" function doesn't work for me.
I have to strings that are identical however, the return value of the compare function still returns 255.
Same applies if the 2 strings are not the same... still 255

Flag_identifier = Compare$ (.Identifier,Word_received,1)

Anyone that can steer me in the right direction?

Thanks
Henk

chipfryer27
Valued Contributor
Valued Contributor
Posts: 774
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times

Re: String compare function

Post by chipfryer27 »

Hi

In the attachment I have four strings

S1 = "abc123"
S2 = "123456"
S3 = "abc123"
S4 = "ABC123"

In calculation boxes I compare them in various order and case sensitivity. If you step through the chart the variable "x" will display the result. Works fine for me.

However I notice you are using a local variable for String1 (.Identifier), could that be the problem? A local variable is only available inside the macro that uses it. A return of 255 means String2 is greater than String1.

Regards

EDIT
Did a test using locals. Didn't like that at all. I set .x1 to 128 as that would never be returned, and did a compare .x1 never changed in value.
Attachments
Compare.fcf
(10.5 KiB) Downloaded 108 times

henker
Posts: 45
Joined: Mon Dec 22, 2008 11:22 pm
Location: Prospect, NS, Canada
Has thanked: 7 times
Been thanked: 2 times

Re: String compare function

Post by henker »

Thanks CF
Weird enough, in simulation mode you can use the local and it actually works. Tonight I will change the local to a global and see if that makes the difference

Henk

Post Reply