The STRING_COMPARE command compares string1 to string2 typographically and puts a number representing that comparison into resultVariable:
By default, the comparison is made ignoring typographical case. If you want to match case, add the matchCase keyword.
See also: STRING, STRING_REPLACE
|
In this example program, you enter two strings and the program tells you the result of the comparison. Enter "quit" without the quotes to quit the program. quitVal = 1 UNTIL quitVal = 0 INPUT STRING "Please enter aStr (or \"quit\" to quit): " aStr STRING_COMPARE aStr "quit" quitVal IF quitVal <> 0 INPUT STRING bStr STRING_COMPARE aStr bStr result IF result < 0 'Commands to do if aStr < bStr: STRING aStr " is less than " bStr resultString ELSEIF result > 0 'Commands to do if aStr > bStr: STRING aStr " is greater than " bStr resultString ELSE 'Commands to do if aStr = bStr: STRING aStr " is equal to " bStr resultString END PRINT resultString END END EXIT "Quitting ..."
|