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".