Compares two values as strings.
Syntax
Result = SRP_String("Compare", String1, String2, IgnoreCase)
Parameters
Parameter | Description |
---|---|
String1 | One of the two strings to be compared. (REQUIRED) |
String2 | The other string to be compared. (REQUIRED) |
IgnoreCase | Indicates whether the comparison is case-sensitive or case-insensitive. (OPTIONAL) |
Returns
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.
Example
Str1 = "27" Str2 = "27." // BASIC+ returns 1 IsEqual = (Str1 = Str2) // Compare service returns -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", "hello", No$) // Case insensitive comparison returns 0 (equal) Result = SRP_String("Compare", "HELLO", "hello", Yes$)