Compares two strings alphabetically.
Result := StrCompare(String1, String2 , CaseSense)
Type: String
The strings to be compared.
Type: String or Integer (boolean)
If omitted, it defaults to Off. Otherwise, specify one of the following values:
On or 1 (true): The comparison is case-sensitive.
Off or 0 (false): The comparison is not case-sensitive, i.e. the letters A-Z are considered identical to their lowercase counterparts.
Locale: The comparison is not case-sensitive according to the rules of the current user's locale. For example, most English and Western European locales treat not only the letters A-Z as identical to their lowercase counterparts, but also non-ASCII letters like Ä and Ü as identical to theirs. Locale is 1 to 8 times slower than Off depending on the nature of the strings being compared.
Logical: Like Locale, but digits in the strings are considered as numerical content rather than text. For example, "A2"
is considered less than "A10"
. However, if two numbers differ only by the presence of a leading zero, the string with leading zero may be considered less than the other string. The exact behavior may differ between OS versions.
Type: Integer
To indicate the relationship between String1 and String2, this function returns one of the following:
To check for a specific relationship between the two strings, compare the result to 0. For example:
a_less_than_b := StrCompare(a, b) < 0 a_greater_than_or_equal_to_b := StrCompare(a, b) >= 0
This function is commonly used for sort callbacks.