|
Mac OS 9
|
Public interfaces for String Comparison and related operations. More...
#include <MacTypes.h>#include <MixedMode.h>#include <TextCommon.h>#include <Script.h>#include <TypeSelect.h>Go to the source code of this file.
Macros | |
| #define | CompareText(aPtr, bPtr, aLen, bLen, itl2Handle) IUMagPString(aPtr, bPtr, aLen, bLen, itl2Handle) |
| #define | IdenticalString(aStr, bStr, itl2Handle) IUEqualPString(aStr, bStr, itl2Handle) |
| #define | IdenticalText(aPtr, bPtr, aLen, bLen, itl2Handle) IUMagIDPString(aPtr, bPtr, aLen, bLen, itl2Handle) |
| #define | StringOrder(aStr, bStr, aScript, bScript, aLang, bLang) IUStringOrder(aStr, bStr, aScript, bScript, aLang, bLang) |
| #define | TextOrder(aPtr, bPtr, aLen, bLen, aScript, bScript, aLang, bLang) IUTextOrder(aPtr, bPtr, aLen, bLen, aScript, bScript, aLang, bLang) |
| #define | LanguageOrder(language1, language2) IULangOrder(language1, language2) |
Functions | |
| short | MacReplaceText (Handle baseText, Handle substitutionText, Str15 key) |
| short | ScriptOrder (ScriptCode script1, ScriptCode script2) |
| short | MacCompareString (ConstStr255Param aStr, ConstStr255Param bStr, Handle itl2Handle) |
| short | IdenticalString (ConstStr255Param aStr, ConstStr255Param bStr, Handle itl2Handle) |
| short | StringOrder (ConstStr255Param aStr, ConstStr255Param bStr, ScriptCode aScript, ScriptCode bScript, LangCode aLang, LangCode bLang) |
| short | CompareText (const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle) |
| short | IdenticalText (const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle) |
| short | TextOrder (const void *aPtr, const void *bPtr, short aLen, short bLen, ScriptCode aScript, ScriptCode bScript, LangCode aLang, LangCode bLang) |
| short | LanguageOrder (LangCode language1, LangCode language2) |
| short | IUMagPString (const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle) |
| short | IUMagIDPString (const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle) |
| short | IUTextOrder (const void *aPtr, const void *bPtr, short aLen, short bLen, ScriptCode aScript, ScriptCode bScript, LangCode aLang, LangCode bLang) |
| short | IULangOrder (LangCode language1, LangCode language2) |
| short | IUScriptOrder (ScriptCode script1, ScriptCode script2) |
| short | IUMagString (const void *aPtr, const void *bPtr, short aLen, short bLen) |
| short | IUMagIDString (const void *aPtr, const void *bPtr, short aLen, short bLen) |
| short | IUCompPString (ConstStr255Param aStr, ConstStr255Param bStr, Handle itl2Handle) |
| short | IUEqualPString (ConstStr255Param aStr, ConstStr255Param bStr, Handle itl2Handle) |
| short | IUStringOrder (ConstStr255Param aStr, ConstStr255Param bStr, ScriptCode aScript, ScriptCode bScript, LangCode aLang, LangCode bLang) |
| short | IUCompString (ConstStr255Param aStr, ConstStr255Param bStr) |
| short | IUEqualString (ConstStr255Param aStr, ConstStr255Param bStr) |
| short | iucomppstring (const char *aStr, const char *bStr, Handle intlHandle) |
| short | iuequalpstring (const char *aStr, const char *bStr, Handle intlHandle) |
| short | iustringorder (const char *aStr, const char *bStr, ScriptCode aScript, ScriptCode bScript, LangCode aLang, LangCode bLang) |
| short | iucompstring (const char *aStr, const char *bStr) |
| short | iuequalstring (const char *aStr, const char *bStr) |
| short | RelString (ConstStr255Param str1, ConstStr255Param str2, Boolean caseSensitive, Boolean diacSensitive) |
| EqualString (strA, strB, FALSE, FALSE) | |
| If then both strings are treated as if they had been upshifted with UprString(though the original contents are not modified) .The RelString function[128K ROMs] is more flexible in that its return code identifies which string is higher or lower in the collating sequence.The IUEqualString and IUCompString functions take into consideration special spelling conventions used in foreign languages.</pre > *@par Copyright short | relstring (const char *str1, const char *str2, Boolean caseSensitive, Boolean diacSensitive) |
| Boolean | equalstring (const char *str1, const char *str2, Boolean caseSensitive, Boolean diacSensitive) |
Variables | |
| If | caseSens = FALSE |
Public interfaces for String Comparison and related operations.
For bug reports, consult the following page on the World Wide Web:
http://developer.apple.com/bugreporter/
| anonymous enum |
Here are the current System 7 routine names and the translations to the older forms. Please use the newer forms in all new code and migrate the older names out of existing code as maintenance permits.
NEW NAME OLD NAME OBSOLETE FORM (no handle)
CompareString (Str255) IUCompPString (hp only) IUCompString (hp only) CompareText (ptr/len) IUMagPString IUMagString IdenticalString (Str255) IUEqualPString (hp only) IUEqualString (hp only) IdenticalText (ptr/len) IUMagIDPString IUMagIDString LanguageOrder IULangOrder ScriptOrder IUScriptOrder StringOrder (Str255) IUStringOrder (hp only) TextOrder (ptr/len) IUTextOrder
RelString CmpString (a only) EqualString (hp only)
ReplaceText
Carbon only supports the new names. The old names are undefined for Carbon targets.
InterfaceLib always has exported the old names. For C macros have been defined to allow the use of the new names. For Pascal and Assembly using the new names will result in link errors.
| short CompareText | ( | const void * | aPtr, |
| const void * | bPtr, | ||
| short | aLen, | ||
| short | bLen, | ||
| Handle | itl2Handle | ||
| ) |
Availability:
| Boolean equalstring | ( | const char * | str1, |
| const char * | str2, | ||
| Boolean | caseSensitive, | ||
| Boolean | diacSensitive | ||
| ) |
Availability:
| EqualString | ( | strA | , |
| strB | , | ||
| FALSE | , | ||
| FALSE | |||
| ) |
\brief See if two Pascal-style strings are equal <pre>EqualString compares two pascal-style length-prefixed strings (optionally
ignoring case and/or diacritical marks), and returns an indication of whether or not they are equal. strAand . . . strBare addresses of Pascal-style length-prefixed strings. caseSens specifies whether or not the comparison should be case-sensitive. It must be one of: FALSEignore character case when comparing ('A' == 'a') TRUEcharacter case is significant ('A' != 'a') diacSens specifies whether or not the comparison should be sensitive to diacritical marks. It must be one of: FALSEignore diacritical marks when comparing (' å' == 'a') TRUEdiacritical marks are significant (' å' != 'a')
a Boolean; it indicates whether the strings are equal, considering the case- and diacritical sensitivity. It is one of: FALSEnot equal TRUEequal
Since EqualString compares pascal-style strings directly, it is handier than converting to C-style strings and using strcmp. Examples: Str255 strA="\pAbcDef"; Str255 strB="\p åbcdef"; EqualString ( strA,strB, TRUE,TRUE); /* Returns FALSE
| short IdenticalString | ( | ConstStr255Param | aStr, |
| ConstStr255Param | bStr, | ||
| Handle | itl2Handle | ||
| ) |
Availability:
| short IdenticalText | ( | const void * | aPtr, |
| const void * | bPtr, | ||
| short | aLen, | ||
| short | bLen, | ||
| Handle | itl2Handle | ||
| ) |
Availability:
| short iucomppstring | ( | const char * | aStr, |
| const char * | bStr, | ||
| Handle | intlHandle | ||
| ) |
Availability:
| short IUCompPString | ( | ConstStr255Param | aStr, |
| ConstStr255Param | bStr, | ||
| Handle | itl2Handle | ||
| ) |
Availability:
| short iucompstring | ( | const char * | aStr, |
| const char * | bStr | ||
| ) |
Availability:
| short IUCompString | ( | ConstStr255Param | aStr, |
| ConstStr255Param | bStr | ||
| ) |
\brief Compare p-strings for international sorting <pre>IUCompString compares two pascal-style strings and indicates which is
greater or if they are equal. It takes into consideration such international characteristics as diacritical marks and ligatures. It DOES differentiate between upper- and lowercase. strAand . . . strBare the addresses of pascal-style length-prefixed strings to be compared.
a signed integer; it describes the collation relationship of strA and strB. It is one of: -1 strA is less than strB 0 strA and strB are equal 1 strA is greater than strB
The return code is the same as used by the familiar C strcmp function. As with strcmp, a short string is always seen as less than a long string. IUCompString may be overkill for your application. It is less efficient than a direct ASCII compare, as it has to look up the "collating weight" of each character of each string. This actually ends up calling IUMagString , which does not require length-prefixed strings. For case-insensitive equality testing (as when matching file names), use IUEqualString or EqualString . The actual comparison function is stored in the itl2 resource.
| short iuequalpstring | ( | const char * | aStr, |
| const char * | bStr, | ||
| Handle | intlHandle | ||
| ) |
Availability:
| short IUEqualPString | ( | ConstStr255Param | aStr, |
| ConstStr255Param | bStr, | ||
| Handle | itl2Handle | ||
| ) |
Availability:
| short iuequalstring | ( | const char * | aStr, |
| const char * | bStr | ||
| ) |
Availability:
| short IUEqualString | ( | ConstStr255Param | aStr, |
| ConstStr255Param | bStr | ||
| ) |
Availability:
| short IULangOrder | ( | LangCode | language1, |
| LangCode | language2 | ||
| ) |
Availability:
| short IUMagIDPString | ( | const void * | aPtr, |
| const void * | bPtr, | ||
| short | aLen, | ||
| short | bLen, | ||
| Handle | itl2Handle | ||
| ) |
Availability:
| short IUMagIDString | ( | const void * | aPtr, |
| const void * | bPtr, | ||
| short | aLen, | ||
| short | bLen | ||
| ) |
Availability:
| short IUMagPString | ( | const void * | aPtr, |
| const void * | bPtr, | ||
| short | aLen, | ||
| short | bLen, | ||
| Handle | itl2Handle | ||
| ) |
These routines are available in InterfaceLib with old names. Macros are provided for C to allow source code use to the new names. IUMagPString()
Availability:
| short IUMagString | ( | const void * | aPtr, |
| const void * | bPtr, | ||
| short | aLen, | ||
| short | bLen | ||
| ) |
Availability:
| short IUScriptOrder | ( | ScriptCode | script1, |
| ScriptCode | script2 | ||
| ) |
Availability:
| short iustringorder | ( | const char * | aStr, |
| const char * | bStr, | ||
| ScriptCode | aScript, | ||
| ScriptCode | bScript, | ||
| LangCode | aLang, | ||
| LangCode | bLang | ||
| ) |
Availability:
| short IUStringOrder | ( | ConstStr255Param | aStr, |
| ConstStr255Param | bStr, | ||
| ScriptCode | aScript, | ||
| ScriptCode | bScript, | ||
| LangCode | aLang, | ||
| LangCode | bLang | ||
| ) |
Availability:
| short IUTextOrder | ( | const void * | aPtr, |
| const void * | bPtr, | ||
| short | aLen, | ||
| short | bLen, | ||
| ScriptCode | aScript, | ||
| ScriptCode | bScript, | ||
| LangCode | aLang, | ||
| LangCode | bLang | ||
| ) |
Availability:
| short LanguageOrder | ( | LangCode | language1, |
| LangCode | language2 | ||
| ) |
Availability:
| short MacCompareString | ( | ConstStr255Param | aStr, |
| ConstStr255Param | bStr, | ||
| Handle | itl2Handle | ||
| ) |
[Mac]CompareString()
Availability:
| short MacReplaceText | ( | Handle | baseText, |
| Handle | substitutionText, | ||
| Str15 | key | ||
| ) |
These routines are available in Carbon with the new names. [Mac]ReplaceText()
Availability:
| If then both strings are treated as if they had been upshifted with UprString (though the original contents are not modified) .The RelString function[128K ROMs] is more flexible in that its return code identifies which string is higher or lower in the collating sequence.The IUEqualString and IUCompString functions take into consideration special spelling conventions used in foreign languages.</ pre> * @par Copyright short relstring | ( | const char * | str1, |
| const char * | str2, | ||
| Boolean | caseSensitive, | ||
| Boolean | diacSensitive | ||
| ) |
Availability:
| short RelString | ( | ConstStr255Param | str1, |
| ConstStr255Param | str2, | ||
| Boolean | caseSensitive, | ||
| Boolean | diacSensitive | ||
| ) |
\brief Compare two Pascal-style strings for sort order <pre>RelString compares two Pascal-style length-prefixed strings (optionally
ignoring case and/or diacritical marks), and returns an indication of which comes first in the ASCII collating sequence. strAand . . . strBare addresses of Pascal-style length-prefixed strings. caseSens specifies whether or not the comparison should be case-sensitive. It must be one of: FALSEignore character case when comparing ('A' == 'a') TRUEcharacter case is significant ('A' != 'a') diacSens specifies whether or not the comparison should be sensitive to diacritical marks. It must be one of: FALSEignore diacritical marks when comparing (' å' == 'a') TRUEdiacritical marks are significant (' å' != 'a')
a signed integer; it indicates the relative collating value of the strings, considering the case- and diacritical-sensitivity. Using the same values as with the familiar strcmp() library function, it is one of: -1strA is less than strB 0strA is equal to strB +1strA is greater than strB
Since RelString compares Pascal-style strings directly, it is handier than converting to C-style strings and using strcmp. If caseSens =FALSE, then both strings are treated as if they had been upshifted with UprString (though the original contents are not modified). For 64K ROMs, the EqualString function can be used to test if two strings are the same. The IUEqualString and IUCompString functions take into consideration special spelling conventions used in foreign languages.
| short ScriptOrder | ( | ScriptCode | script1, |
| ScriptCode | script2 | ||
| ) |
Availability:
| short StringOrder | ( | ConstStr255Param | aStr, |
| ConstStr255Param | bStr, | ||
| ScriptCode | aScript, | ||
| ScriptCode | bScript, | ||
| LangCode | aLang, | ||
| LangCode | bLang | ||
| ) |
Availability:
| short TextOrder | ( | const void * | aPtr, |
| const void * | bPtr, | ||
| short | aLen, | ||
| short | bLen, | ||
| ScriptCode | aScript, | ||
| ScriptCode | bScript, | ||
| LangCode | aLang, | ||
| LangCode | bLang | ||
| ) |
Availability: