Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 5 - Text Utilities / Text Utilities Reference
Routines / Comparing Strings for Equality


EqualString

The EqualString function compares two Pascal strings for equality, using the comparison rules of the Macintosh file system. The comparison performed by EqualString is a simple, character-by-character value comparison. This function does not make use of any script or language information; it assumes the use of a Roman script system.

FUNCTION EqualString (aStr, bStr: Str255;
                      caseSens, diacSens: Boolean): Boolean;
aStr
One of the Pascal strings to be compared.
bStr
The other Pascal string to be compared.
caseSens
A flag that indicates how to handle case-sensitive information during the comparison. If the value of caseSens is TRUE, uppercase characters are distinguished from the corresponding lowercase characters. If it is FALSE, case information is ignored.
diacSens
A flag that indicates how to handle information about diacritical marks during the string comparison. If the value of diacSens is TRUE, characters with diacritical marks are distinguished from the corresponding characters without diacritical marks during the comparison. If it is FALSE, diacritical marks are ignored.
DESCRIPTION
EqualString returns TRUE if the two strings are equal and FALSE if they are not equal. If its value is TRUE, EqualString distinguishes uppercase characters from the corresponding lowercase characters. If its value is FALSE, EqualString ignores diacritical marks during the comparison.

SPECIAL CONSIDERATIONS
The EqualString function is not localizable.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the EqualString function are
Trap macroSelector
_CmpString$A03C

This trap macro can take optional arguments, each of which changes the default setting used by the macro when it is called without arguments. Each of these arguments corresponds to the Boolean parameters that are used with the Pascal function call. The various permutations of this trap macro are shown below; you must type each exactly as it is shown. The syntax shown here applies to the MPW Assembler; if you are using another development system, be sure to consult its documentation for the proper syntax.
Macro permutation
Value of
diacSens
Value of caseSens
_CmpStringFALSEFALSE
_CmpString ,MARKSTRUEFALSE
_CmpString ,CASEFALSETRUE
_CmpString ,MARKS,CASETRUETRUE

The registers on entry and exit for this routine are
Registers on entry
A0pointer to first character of the first string
A1pointer to first character of the second string
D0high-order word: number of bytes in the first string low-order word: number of bytes in the second string
Registers on exit
D0long word result: 0 if strings are equal, 1 if strings are not equal


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996