Page History
...
Returns an integer less than zero if String1 is less than String 2. Returns an integer greater than zero if String1 is greater than String2. Returns 0 if the strings are equal.
Remarks
Added in 2.2.6
The Compare service compares two variables as strings. When you use BASIC+ comparison operators, the variables' contents will be converted into numbers if possible. The Compare service, on the other hand, always does a character by character comparison.
...
Code Block |
---|
Str1 = "27" Str2 = "27." // In BASIC+, thesereturns are equal If 1 IsEqual = (Str1 = Str2 then) // Compare service returns Ans = "Equal Value" end else Ans = "Not Equal Value" end // Using the Compare service, these strings are not equal If-1 (Str1 is less than Str2) Result = SRP_String("Compare", Str1, Str2) // Case sensitive comparison returns 1 (Str1 is greater than Str2) Result = SRP_String("Compare", "HELLO", Str1"hello", Str2No$) // =Case 0insensitive then comparison returns Ans0 (equal) Result = "Equal Strings" end else Ans = "Not Equal Strings" endSRP_String("Compare", "HELLO", "hello", Yes$) |