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 Ans = "Equal Value" end else Ans = "Not Equal Value" end ) // UsingCompare theservice Comparereturns service, these strings are not equal If-1 (Str1 is less than Str2) Result = SRP_String("Compare", Str1, Str2) = 0 then Ans = "Equal Strings" end else Ans = "Not Equal Strings" end // Case sensitive comparison returns 0 Ans 1 (Str1 is greater than Str2) Result = SRP_String("Compare", "HELLO", "hello", No$) // Case insensitive comparison returns 1 Ans0 (equal) Result = SRP_String("Compare", "HELLO", "hello", Yes$) |
...