StrCmp

(Engine-Level Function)

Description: Performs a case sensitive comparison of two text expressions and returns an indication of whether the first string is greater than, less than or equal to the second.
Returns: Numeric
Usage: Script or steady state.
Function Groups: String and Buffer
Related to: StrLen
Format: StrCmp(String1, String2)
Parameters:  
String1
Required. Any text expression giving the first string to be used for the comparison.
String2
Required. Any text expression giving the second string to be used for the comparison.
Comments: When one string is referred to as greater than or less than another, it means each character has been converted to its ASCII value and the two strings have been compared character value by character value. In ASCII, the alphabet is numbered in ascending order, and uppercase letters are listed first, so their values are less than lower case letters.
This function returns the following values:

Value

Meaning

-1

String1 is less than String2

0

String1 is equal to (identical to) String2

+1

String1 is greater than String2

Examples:

p = StrCmp("ABC", "abc");
q = StrCmp("AbC", "ABc");
r = StrCmp("ABC", "ABCD");
s = StrCmp("ABC", "ABC");

The values for p, q, r and s will be -1, 1, -1 and 0 respectively.