Important: The information in this document is obsolete and should not be used for new development.
CompareString
TheCompareString
function compares two Pascal strings, making use of the string comparison information from a resource that you specify as a parameter. It takes both primary and secondary sorting orders into consideration and returns a value that indicates the sorting order of the first string relative to the second string.
FUNCTION CompareString(aStr, bStr: Str255; itl2Handle: Handle): Integer;
aStr
- One of the Pascal strings to be compared.
bStr
- The other Pascal string to be compared.
itl2Handle
- The handle to the string-manipulation resource that contains string comparison information.
DESCRIPTION
CompareString
returns -1 if the first string is less than the second string, 0 if the
first string is equal to the second string, and 1 if the first string is greater than
the second string.The
itl2Handle
parameter is used to specify a string-manipulation resource. If the value of this parameter isNIL
,CompareString
makes use of the resource for the current script. The string-manipulation resource includes routines and tables for modifying string comparison and tables for case conversion and stripping of
diacritical marks.Specifying a resource as a parameter is described in the section "Obtaining Resource Information," beginning on page 5-4.
SPECIAL CONSIDERATIONS
CompareString
may move memory; your application should not call this function at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
There is no trap macro for theCompareString
function. Instead, you must convert the Pascal string into a text string by creating a pointer to its first character and finding its length, and then use the same macro as you do for theCompareText
function, which is described next.