Page 1 of 1
Compare strings!
Posted: Mon Mar 23, 2026 7:52 pm
by jgu1
Hi all!
Inside an If decision I can write: String_One = String_Two, it working.
In Built_in_funktion fs is the CompareS( ), how do I use this in an If funktion I have test with CompareS( String_One, String_Two ) and more attemp?
I have seach in Wiki but can´t find examble and what is best
Thank´s
Re: Compare strings!
Posted: Mon Mar 23, 2026 7:57 pm
by BenR
Hello,
The decision and the compare function both end up with similar c code.
To use the compare function you do this
Result = compare$(str1, str2, case)
Result is 0 if the strings match.
Case is 0 for case insensitive or 1 for case sensitive.
The new str1 = str2 in the decision allows for a shorthanded way of writing compare$(str1, str2, 1) == 0
Re: Compare strings!
Posted: Mon Mar 23, 2026 8:03 pm
by jgu1
Thank you Ben

Re: Compare strings!
Posted: Tue Mar 24, 2026 10:01 am
by Steve-Matrix
Just to add, the result of the "Compare$" function can also be used to determine whether the strings are "higher" or "lower" than each other. For example, see this:
Code: Select all
s1 = "abc"
s2 = "abd"
result = Compare$(s1, s2, 0)
In this case, "result" would be equal to -1 in simulation because "abc" is less than "abd" alphabetically.
Similarly, Compare$("yes", "no", 0) would return 1 (because "yes" is after "no" alphabetically).
Well, actually it's more than alphabetically because it works the same way for the whole ascii character set, e.g. "!!" < "??" and so Compare$("!!", "??", 0) would return -1.
Note that the above is how the simulation within Flowcode works.
It may be different in the actual code running on a chip. I've just checked and the 8-bit PIC targets return "0" for equal, "1" for greater than, and "255" for less than. So it's similar, but "255" is returned instead of "-1".
Re: Compare strings!
Posted: Tue Mar 24, 2026 10:05 am
by Steve-Matrix
Also, the direct string comparison current only works with the "is equal to" ("==" / "=") and "is not equal to" ("<>" / "!=") operators. We may change this in a future release so it also works with "greater than" (etc).
Re: Compare strings!
Posted: Tue Mar 24, 2026 4:30 pm
by jgu1
Hi Steve!
Thank you for your explanation and examble, I will play and test your tip it make sense, for me, thank´s
In FC10 it is possible to to call/add the compare string from the If decision (f§) in the drop down list, it is not visible in F11, I have to add a Calculation box and find it this way?
Jorgen
Re: Compare strings!
Posted: Tue Mar 24, 2026 4:56 pm
by BenR
Hi Jorgen,
It's certainly possible to use this in a decision icon in v10.
However I don't think you can select/choose the function from a drop down list inside the decision icon.
Re: Compare strings!
Posted: Tue Mar 24, 2026 6:48 pm
by jgu1
Hi Ben!
Sorry, I am not so good to explain. I think if you look at the att picture you see what I mean I could not see the " F§ " in FC11 I have not expand the window in FC11
Sorry for the inconvenience

and thak´s
Br Jorgen