A function identified as deprecated has been superseded and may become unsupported in the future.
Converts a C string to a Pascal string. (Deprecated in Mac OS X v10.4. You should store strings as Core Foundation CFStrings instead. See CFString Reference.)
StringPtr c2pstr ( char *aStr );
TextUtils.h
Converts a C string to a Pascal string. (Deprecated in Mac OS X v10.4. You should store strings as Core Foundation CFStrings instead. See CFString Reference.)
StringPtr C2PStr ( Ptr cString );
TextUtils.h
Converts a C string to a Pascal string. (Deprecated in Mac OS X v10.4. You should store strings as Core Foundation CFStrings instead. See CFString Reference.)
void c2pstrcpy ( Str255 dst, const char *src );
On output, the Pascal string.
The C string you want to convert.
This function allows in-place conversion. That is, the src
and dst
parameters can point to the same memory location.
TextUtils.h
Compares two Pascal strings, making use of the string comparison information from a resource that you specify as a parameter. (Deprecated in Mac OS X v10.4. Use CFStringCompare
or UCCompareText
instead.)
short CompareString ( ConstStr255Param aStr, ConstStr255Param bStr, Handle itl2Handle );
One of the Pascal strings to be compared.
The other Pascal string to be compared.
The handle to the string-manipulation resource that contains string comparison information. If the value of this parameter is NULL
, CompareString
makes use of the resource for the current script. The string-manipulation resource includes functions and tables for modifying string comparison and tables for case conversion and stripping of diacritical marks.
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.
This function 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.
CompareString
may move memory; your application should not call this function at interrupt time.
StringCompare.h
Compares two text strings, making use of the string comparison information from a resource that you specify as a parameter. (Deprecated in Mac OS X v10.4. Use CFStringCompare
or UCCompareText
instead.)
short CompareText ( const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle );
A pointer to the first character of the first text string.
A pointer to the first character of the second text string.
The length, in bytes, of the first text string.
The length, in bytes, of the second text string.
A handle to a string-manipulation ('itl2'
) resource that contains string comparison information. If the value of this parameter is NULL
, CompareText
makes use of the resource for the current script. The string-manipulation resource includes functions and tables for modifying string comparison and tables for case conversion and stripping of diacritical marks.
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.
This function 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.
CompareText
may move memory; your application should not call this function at interrupt time.
StringCompare.h
Converts a C string to a Pascal string. (Deprecated in Mac OS X v10.4. You should store strings as Core Foundation CFStrings instead. See CFString Reference.)
void CopyCStringToPascal ( const char *src, Str255 dst );
The C string you want to convert.
On output, the Pascal string.
This function allows in-place conversion. That is, the src
and dst
parameters can point to the same memory location.
TextUtils.h
Converts a Pascal String to a C string. (Deprecated in Mac OS X v10.4. You should store strings as Core Foundation CFStrings instead. See CFString Reference.)
void CopyPascalStringToC ( ConstStr255Param src, char *dst );
The Pascal string you want to convert.
On output, the C string.
This function allows in-place conversion. That is, the src
and dst
parameters can point to the same memory location.
TextUtils.h
Disposes of a universal procedure pointer to an index-to-string callback. (Deprecated in Mac OS X v10.4.)
void DisposeIndexToStringUPP ( IndexToStringUPP userUPP );
The universal procedure pointer.
See the callback IndexToStringProcPtr
for more information.
TypeSelect.h
Compares two Pascal strings for equality, using the comparison rules of the Macintosh file system. (Deprecated in Mac OS X v10.4. Use CFStringCompare
instead.)
Boolean EqualString ( ConstStr255Param str1, ConstStr255Param str2, Boolean caseSensitive, Boolean diacSensitive );
One of the Pascal strings to be compared.
The other Pascal string to be compared.
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.
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.
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.
The comparison is a simple, character-by-character value comparison. This function does not make use of any script or language information (i.e., is not localizable); it assumes the use of a Roman script system.
StringCompare.h
Converts an internal floating-point representation of a number into a string that can be presented to the user, using a NumFormatStringRec
structure to specify how the output number string is formatted (Deprecated in Mac OS X v10.4. Use CFNumberFormatterCreateNumberFromString
instead.)
FormatStatus ExtendedToString ( const extended80 *x, const NumFormatString *myCanonical, const NumberParts *partsTable, Str255 outString );
A pointer to a floating-point value in 80-bit SANE representation.
A pointer to the internal representation of the formatting information for numbers, as produced by the StringToFormatRec
function.
A pointer to a structure, obtained from the tokens ('itl4'
) resource, that shows the correspondence between generic number part separators (tokens) and their localized version (for example, a thousand separator is a comma in the United States and a decimal point in France).
On output, contains the number formatted according to the information in myFormatRec
.
A value that denotes the confidence level for the conversion that it performed. The low byte of the FormatStatus
value is of type FormatResultType
. Be sure to cast the result of ExtendedToString
to a type FormatResultType
before working with it. See the description of the FormatStatus
data type.
ExtendedToString
creates a string representation of a floating-point number, using the formatting information in the myFormatRec
parameter (which was created by a previous call to StringToFormatRec
) to determine how the number should be formatted for output. It uses the number parts table to determine the component parts of the number string.
To obtain a handle to the number parts table from a tokens resource, use the GetIntlResourceTable
function.
NumberFormatting.h
Finds the next block of subscript text within a script run. (Deprecated in Mac OS X v10.4. There is no replacement function because this capability is no longer needed in Mac OS X.)
ScriptRunStatus FindScriptRun ( Ptr textPtr, long textLen, long *lenUsed );
A pointer to the text string to be analyzed.
The number of bytes in the text string.
On output, a pointer to the length, in bytes, of the script run that begins with the first character in the string; this length is always greater than or equal to 1, unless the string passed in is of length 0.
Identifies the run as either native text, Roman, or one of the defined subscripts of the script system and returns a structure of type ScriptRunStatus
. See the description of the ScriptRunStatus
data type.
The FindScriptRun
function is used to identify blocks of subscript text in a string, taking into account script and language considerations, making use of tables in the string-manipulation ('itl2'
) resource in its computations. Some script systems include subscripts, which are character sets that are subsidiary to the main character set. One useful subscript is the set of all character codes that have the same meaning in Roman as they do in a non-Roman script. For other scripts such as Japanese, there are additional useful subscripts. For example, a Japanese script system might include some Hiragana characters that are useful for input methods.
FindScriptRun
computes the length of the current run of subscript text in the text string specified by textPtr
and textLen
. It assigns the length, in bytes, to the lenUsed
parameter and returns a status code. You can advance the text pointer by the value of lenUsed
to make subsequent calls to this function. You can use this function to identify runs of subscript characters so that you can treat them separately.
Word processors and other applications can call FindScriptRun
to separate style runs of native text from non-native text. You can use this capability to extract those characters and apply a different font to them.
TextUtils.h
Determines the beginning and ending boundaries of a word in a text string. (Deprecated in Mac OS X v10.4. Use UCFindTextBreak
instead.)
void FindWordBreaks ( Ptr textPtr, short textLength, short offset, Boolean leadingEdge, BreakTablePtr breaks, OffsetTable offsets, ScriptCode script );
A pointer to the text string to be examined.
The number of bytes in the text string.
A byte offset into the text. This parameter plus the leadingEdge
parameter determine the position of the character at which to start the search.
A flag that specifies which character should be used to start the search. If leadingEdge
is TRUE
, the search starts with the character specified in the offset
parameter; if it is FALSE
, the search starts with the character preceding the offset.
A pointer to a word-break table of type NBreakTable
or BreakTable
. If the value of this pointer is 0, the default word-break table of the script system specified by the script
parameter is used. If the value of this pointer is –1, the default line-break table of the specified script system is used.
On output, the values in this table indicate the boundaries of the word that has been found.
The script code for the script system whose tables are used to determine where word boundaries occur.
FindWordBreaks
searches for a word in a text string, taking into account script and language considerations, making use of tables in the string-manipulation ('itl2'
) resource in its computations. The textPtr
and textLength
parameters specify the text string that you want searched. The offset
parameter and leadingEdge
parameter together indicate where the search begins.
FindWordBreaks
searches backward through the text string for one of the word boundaries and forward through the text string for its other boundary. It uses the definitions in the table specified by nbreaks
to determine what constitutes the boundaries of a word. Each script system’s word-break table is part of its string-manipulation ('itl2'
) resource.
FindWordBreaks
returns its results in an OffsetTable
structure. FindWordBreaks
uses only the first element of this three-element table. Each element is a pair of integers: offFirst
and offSecond
.
FindWordBreaks
places the offset from the beginning of the text string to just before the leading edge of the character of the word that it finds in the offFirst
field.
FindWordBreaks
places the offset from the beginning of the text string to just after the trailing edge of the last character of the word that it finds in the offSecond
field. For example, if the text “This is it” is passed with offset
set to 0 and leadingEdge
set to TRUE
, then FindWordBreaks
returns the offset pair (0,4).
If leadingEdge
is TRUE
and the value of offset
is 0, then FindWordBreaks
returns the offset pair (0,0). If leadingEdge
is FALSE
and the value of offset
equals the value of textLength
, then FindWordBreaks
returns the offset pair with values (textLength
, textLength
).
TextUtils.h
Converts an internal representation of number formatting information into a number format specification string, which can be displayed and modified. (Deprecated in Mac OS X v10.4. Use CFNumberFormatterGetFormat
instead.)
FormatStatus FormatRecToString ( const NumFormatString *myCanonical, const NumberParts *partsTable, Str255 outString, TripleInt positions );
A pointer to the internal representation of number formatting information, as created by a previous call to the StringToFormatRec
function.
A pointer to a structure, obtained from the tokens ('itl4'
) resource, that shows the correspondence between generic number part separators (tokens) and their localized version (for example, a thousand separator is a comma in the United States and a decimal point in France).
On output, contains the number format specification string.
An array that specifies the starting position and length of each of the three possible format strings (positive, negative, or zero) in the number format specification string. Semicolons are used as separators in the string.
A value that denotes the confidence level for the conversion that it performed. The low byte of the FormatStatus
value is of type FormatResultType
. Be sure to cast the result of FormatRecToString
to a type FormatResultType
before working with it. See the description of the FormatStatus
data type.
FormatRecToString
is the inverse operation of StringToFormatRec
. The internal representation of the formatting information in myFormatRec
must have been created by a prior call to the StringToFormatRec
function. The information in the number parts table specifies how to build the string representation.
The output number format specification string in outString
specifies how numbers appear. This string contains three parts, which are separated by semicolons. The first part is the positive number format, the second is the negative number format, and the third part is the zero number format.
The positions
parameter is an array of three integers (a TripleInt
value), which specifies the starting position in outString
of each of three formatting specifications:
positions[fPositive]
. The index in outString
of the first byte of the formatting specification for positive number values.
positions[fNegative]
. The index in outString
of the first byte of the formatting specification for negative number values.
positions[fZero]
. The index in outString
of the first byte of the formatting specification for zero number values.
To obtain a handle to the number parts table from a tokens resource, use the GetIntlResourceTable
function.
NumberFormatting.h
Loads a string from a string list ('STR#'
) resource into memory, given the resource ID of the string list and the index of the individual string. (Deprecated in Mac OS X v10.4. Use CFBundleCopyLocalizedString
instead.)
void GetIndString ( Str255 theString, short strListID, short index );
On output, the Pascal string result; specifically, a copy of the string from a string list that has the resource ID provided in the strListID
parameter. If the resource that you specify cannot be read or the index that you specify is out of range for the string list, GetIndString
sets theString
to an empty string.
The resource ID of the 'STR#'
resource that contains the string list.
The index of the string in the list. This is a value from 1 to the number of strings in the list that is referenced by the strListID
parameter.
If necessary, GetIndString
reads the string list from the resource file by calling the Resource Manager function GetResource
. GetIndString
accesses the string specified by the index
parameter and copies it into theString
.
GetIndString
may move memory; your application should not call this function at interrupt time.
TextUtils.h
Loads a string from a string ('STR'
) resource into memory. (Deprecated in Mac OS X v10.4. Use CFBundleCopyLocalizedString
instead.)
StringHandle GetString ( short stringID );
The resource ID of the string ('STR
'
) resource containing the string.
A handle to a string with the specified resource ID. If necessary, GetString
reads the handle form the resource file. If GetString
cannot read the resource, it returns NULL
.
GetString
calls the GetResource
function of the Resource Manager to access the string. This means that if the specified resource is already in memory, GetString
simply returns its handle.
Like the NewString
function, GetString
returns a handle whose size is based upon the actual length of the string.
If your application uses a large number of strings, it is more efficient to store them in a string list ('STR#'
) resource than as individual resources in the resource file. You then use the GetIndString
function to access each string in the list.
GetString
does not create a copy of the string.
GetString
may move memory; your application should not call this function at interrupt time.
TextUtils.h
Compares two Pascal strings for equality, making use of the string comparison information from a resource that you specify as a parameter. (Deprecated in Mac OS X v10.4. Use CFStringCompare
instead.)
short IdenticalString ( ConstStr255Param aStr, ConstStr255Param bStr, Handle itl2Handle );
One of the Pascal strings to be compared.
The other Pascal string to be compared.
A handle to a string-manipulation ('itl2'
) resource that contains string comparison information.
The itl2Handle
parameter is used to specify a string-manipulation resource. If the value of this parameter is NULL
, IdenticalString
makes use of the resource for the current script. The string-manipulation resource includes tables for modifying string comparison and tables for case conversion and stripping of diacritical marks.
Returns 0 if the two strings are equal; 1 if they are not equal. It compares the two strings without regard for secondary sorting order, the meaning of which depends on the language of the strings. For example, for the English language, using only primary differences means that IdenticalString
ignores diacritical marks and does not distinguish between lowercase and uppercase. For example, if the two strings are 'Rose'
and 'rosé'
, IdenticalString
considers them equal and returns 0.
IdenticalString
uses only primary differences in its comparison.
IdenticalString
may move memory; your application should not call this function at interrupt time.
StringCompare.h
Compares two text strings for equality, making use of the string comparison information from a resource that you specify as a parameter. (Deprecated in Mac OS X v10.4. Use CFStringCompare
instead.)
short IdenticalText ( const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle );
A pointer to the first character of the first text string.
A pointer to the first character of the second text string.
The length, in bytes, of the first text string.
The length, in bytes, of the second text string.
A handle to a string-manipulation ('itl2'
) resource that contains string comparison information.
The itl2Handle
parameter is used to specify a string-manipulation resource. If the value of this parameter is NULL
, IdenticalText
makes use of the resource for the current script. The string-manipulation resource includes functions and tables for modifying string comparison and tables for case conversion and stripping of diacritical marks.
0 if the two text strings are equal; 1 if they are not equal. It compares the strings without regard for secondary sorting order, which means that it ignores diacritical marks and does not distinguish between lowercase and uppercase. For example, if the two text strings are 'Rose'
and 'rosé'
, IdenticalText
considers them equal and returns 0.
IdenticalText
uses only primary sorting order in its comparison.
IdenticalText
may move memory; your application should not call this function at interrupt time.
StringCompare.h
Call an index-to-string callback. (Deprecated in Mac OS X v10.4.)
Boolean InvokeIndexToStringUPP ( short item, ScriptCode *itemsScript, StringPtr *itemsStringPtr, void *yourDataPtr, IndexToStringUPP userUPP );
You should not need to use the function InvokeIndexToStringUPP
, as the system calls your index-to-string callback function for you. See the callback IndexToStringProcPtr
for more information.
TypeSelect.h
Determines the order in which strings in two different languages should be sorted. (Deprecated in Mac OS X v10.4. Use CFStringCompare
or UCCompareText
instead.)
short LanguageOrder ( LangCode language1, LangCode language2 );
The language code of the first language.
The language code of the second language.
A value that indicates the sorting order: –1 if strings in the first language should be sorted before sorting text in the second language, 1 if strings in the first language should be sorted after sorting strings in the second language, or 0 if the sorting order does not matter (that is, if the languages are the same).
LanguageOrder
takes a pair of language codes and determines in which order strings from the first language should be sorted relative to strings from the second language.
“Implicit Language Codes” are listed in the Constants section. The implicit language codes scriptCurLang
and scriptDefLang
are not valid for LanguageOrder
because the script system being used is not specified as a parameter to this function.
LanguageOrder
may move memory; your application should not call this function at interrupt time.
StringCompare.h
Converts any uppercase characters in a text string into their lowercase equivalents. (Deprecated in Mac OS X v10.4. Use CFStringLowercase
instead.)
void LowercaseText ( Ptr textPtr, short len, ScriptCode script );
A pointer to the text string to be converted.
The number of bytes in the text string. The text string can be up to 32 KB in length.
The script code for the script system whose resources are used to determine the results of converting characters.
The conversion uses tables in the string-manipulation ('itl2'
) resource of the script specified by the value of the script
parameter. You can specify smSystemScript
to use the system script and smCurrentScript
to use the script of the current font in the current graphics port.
LowercaseText
traverses the characters starting at the address specified by textPtr
and continues for the number of characters specified in len
. It converts any uppercase characters in the text into lowercase.
If LowercaseText
cannot access the specified resource, it generates an error code and does not modify the string. You need to call the ResError
function to determine which, if any, error occurred.
LowercaseText
may move memory; your application should not call this function at interrupt time.
TextUtils.h
Creates a new universal procedure pointer (UPP) to an index-to-string callback. (Deprecated in Mac OS X v10.4.)
IndexToStringUPP NewIndexToStringUPP ( IndexToStringProcPtr userRoutine );
A pointer to your index-to-string callback.
On return, a UPP to the index-to-string callback.
See the callback IndexToStringProcPtr
for more information.
TypeSelect.h
Allocates memory in the heap for a string, copies its contents, and produces a handle for the heap version of the string. (Deprecated in Mac OS X v10.4. Use CFStringCreateCopy
instead.)
StringHandle NewString ( ConstStr255Param theString );
A Pascal string that you want copied onto the heap.
A handle to the newly allocated string. If the string cannot be allocated, NewString
returns NULL
. The size of the allocated string is based on the actual length of theString
, which may not be 255 bytes.
Before using Pascal string functions that can change the length of the string, it is a good idea to maximize the size of the string object on the heap. You can call either the SetString
function or the Memory Manager function SetHandleSize
to modify the string’s size.
NewString
may move memory; your application should not call this function at interrupt time.
TextUtils.h
Converts a long integer value into a Pascal string. (Deprecated in Mac OS X v10.4. Use CFStringCreateWithFormat
instead.)
void NumToString ( long theNum, Str255 theString );
A long integer value. If the value of the number in the parameter theNum
is negative, the string begins with a minus sign; otherwise, the sign is omitted.
On output, contains the Pascal string representation of the number. Leading zeros are suppressed, except that a value of 0 produces the string “0”. NumToString
does not include thousand separators or decimal points in its formatted output.
NumToString
creates a string representation of theNum
as a base-10 value and returns the result in theString
.
Unless patched by a script system with different rules, this function assumes that you are using standard numeric token processing, meaning that the Roman script system number processing rules are used.
For functions that make use of the token-processing information that is found in the tokens ('itl4'
) resource of script systems for converting numbers, see the sections “Using Number Format Specification Strings for International Number Formatting” and “Converting Between Strings and Floating-Point Numbers”.
NumToString
may move memory; your application should not call this function at interrupt time.
NumberFormatting.h
Converts a Pascal string to a C string. (Deprecated in Mac OS X v10.4. You should store strings as Core Foundation CFStrings instead. See CFString Reference.)
char * p2cstr ( StringPtr aStr );
TextUtils.h
Converts a Pascal string to a C string. (Deprecated in Mac OS X v10.4. You should store strings as Core Foundation CFStrings instead. See CFString Reference.)
Ptr P2CStr ( StringPtr pString );
TextUtils.h
Converts a Pascal string to a C string. (Deprecated in Mac OS X v10.4. You should store strings as Core Foundation CFStrings instead. See CFString Reference.)
void p2cstrcpy ( char *dst, ConstStr255Param src );
On output, the C string.
The Pascal string you want to convert.
This function allows in-place conversion. That is, the src
and dst
parameters can point to the same memory location.
TextUtils.h
Compares two Pascal strings using the string comparison rules of the Macintosh file system and returns a value that indicates the sorting order of the first string relative to the second string. (Deprecated in Mac OS X v10.4. Use CFStringCompare
or UCCompareText
instead.)
short RelString ( ConstStr255Param str1, ConstStr255Param str2, Boolean caseSensitive, Boolean diacSensitive );
One of the Pascal strings to be compared.
The other Pascal string to be compared.
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.
A flag that indicates how to handle information about diacritical marks during the string comparison. If the value of diacSensitive
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.
Returns –1 if the first string is less than the second string, 0 if the two strings are equal, and 1 if the first string is greater than the second string. It compares the two strings in the same manner as does the EqualString
function, by simply looking at the ASCII values of their characters. However, RelString
provides more information about the two strings—it indicates their relationship to each other, rather than determining if they are exactly equal.
This function does not make use of any script or language information; it assumes the original Macintosh character set only.
The RelString
function is not localizable and does not work properly with non-Roman script systems.
StringCompare.h
Compares two strings. (Deprecated in Mac OS X v10.4. Use CFStringCompare
or UCCompareText
instead.)
Not recommended
short relstring ( const char *str1, const char *str2, Boolean caseSensitive, Boolean diacSensitive );
The string to be compared to str2
.
The string to be compared to str1
.
A flag that indicates how to handle case-sensitive information during the comparison.
A flag that indicates how to handle information about diacritical marks during the string comparison.
Returns –1 if the first string is less than the second string, 0 if the two strings are equal, and 1 if the first string is greater than the second string.
This function is not recommended. Instead, see the function RelString
.
StringCompare.h
Searches text on a character-by-character basis, replacing all instances of a string in that text with another string. (Deprecated in Mac OS X v10.4. Use CFStringReplace
instead.)
short ReplaceText ( Handle baseText, Handle substitutionText, Str15 key );
A handle to the string in which ReplaceText
is to substitute text.
A handle to the string that ReplaceText
uses as substitute text.
A Pascal string of less than 16 bytes that ReplaceText
searches for.
An integer value; if positive, it indicates the number of substitutions performed; if negative, it indicates an error. The constant noErr
is returned if there was no error and no substitutions were performed.
ReplaceText
searches the text specified by the baseText
parameter for instances of the string in the key
parameter and replaces each instance with the text specified by the substitutionText
parameter. ReplaceText
searches on a character-by-character basis (as opposed to byte-by-byte), so it works properly for all script systems, including 2-byte script systems. It recognizes 2-byte characters in script systems that contain them and advances the search appropriately after encountering a 2-byte character.
ReplaceText
may move memory; your application should not call this function at interrupt time.
StringCompare.h
Determines the order in which strings in two different scripts should be sorted. (Deprecated in Mac OS X v10.4. Use CFStringCompare
or UCCompareText
instead.)
short ScriptOrder ( ScriptCode script1, ScriptCode script2 );
The script code of the first script.
The script code of the second script.
A value that indicates the sorting order: –1 if strings in the first script should be sorted before strings in the second script are sorted, 1 if strings in the first script should be sorted after strings in the second script are sorted, or 0 if the sorting order does not matter (that is, if the scripts are the same).
Text of the system script is always first in a sorted list, regardless of the result returned by this function. When determining the order in which text from two different script systems should be sorted, the system script always sorts first, and scripts that are not enabled and installed always sort last. Invalid script or language codes always sort after valid ones.
ScriptOrder
may move memory; your application should not call this function at interrupt time.
StringCompare.h
Changes the contents of a string referenced by a string handle, replacing the previous contents by copying the specified string. (Deprecated in Mac OS X v10.4. Use CFStringCreateWithPascalString
and CFStringReplaceAll
.)
void SetString ( StringHandle theString, ConstStr255Param strNew );
A Pascal string.
A handle to the string in memory whose contents you are replacing. If the new string (theString
) is larger than the string originally referenced by strNew
, SetString
automatically resizes the handle and copies in the contents of the specified string.
SetString
may move memory; your application should not call this function at interrupt time.
TextUtils.h
Compares two Pascal strings, taking into account the script system and language for each of the strings. (Deprecated in Mac OS X v10.4. Use CFStringCompare
or UCCompareText
instead.)
short StringOrder ( ConstStr255Param aStr, ConstStr255Param bStr, ScriptCode aScript, ScriptCode bScript, LangCode aLang, LangCode bLang );
One of the Pascal strings to be compared.
The other Pascal string to be compared.
The script code for the second string.
The script code for the first string.
The language code for the first string.
The language code for the second string.
–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 ordering of script and language codes, which is based on information in the script-sorting resource, is considered in determining the relationship of the two strings.
This function takes both primary and secondary sorting orders into consideration and returns a value that indicates whether the first string is less than, equal to, or greater than the second string.
“Implicit Language Codes” are listed in the Constants section. Most applications specify the language code scriptCurLang
for both the aLang
and bLang
values.
StringOrder
first calls ScriptOrder
; if the result of ScriptOrder
is not 0 (that is, if the strings use different scripts), StringOrder
returns the same result.
StringOrder
next calls LanguageOrder
; if the result of LanguageOrder
is not 0 (that is, if the strings use different languages), StringOrder
returns the same result.
At this point, StringOrder
has two strings that are in the same script and language, so it compares them by using the sorting rules for that script and language, applying both the primary and secondary sorting orders. If that script is not installed and enabled, it uses the sorting rules specified by the system script or the font script, depending on the state of the international resources selection flag.
The StringOrder
function is primarily used to insert Pascal strings in a sorted list; for sorting, rather than using this function, it may be faster to sort first by script and language by using the ScriptOrder
and LanguageOrder
functions, and then to call the CompareString
function, to sort strings within a script or language group.
StringOrder
may move memory; your application should not call this function at interrupt time.
StringCompare.h
Converts a string representation of a number into a floating-point number, using a NumFormatStringRec
structure to specify how the input number string is formatted. (Deprecated in Mac OS X v10.4. Use CFNumberFormatterCreateStringWithNumber
instead.)
FormatStatus StringToExtended ( ConstStr255Param source, const NumFormatString *myCanonical, const NumberParts *partsTable, extended80 *x );
A Pascal string that contains the string representation of a number.
A pointer to the internal representation of the formatting information for numbers, as produced by the StringToFormatRec
function.
A pointer to a structure, obtained from the tokens ('itl4'
) resource, that shows the correspondence between generic number part separators (tokens) and their localized version (for example, a thousand separator is a comma in the United States and a decimal point in France).
On output, contains a pointer to the 80-bit SANE representation of the floating-point number.
A value that denotes the confidence level for the conversion that it performed. The low byte of the FormatStatus
value is of type FormatResultType
. Be sure to cast the result of StringToExtended
to a type FormatResultType
before working with it. StringToExtended
returns an 80-bit, not a 96-bit, representation. See the description of the FormatStatus
data type.
StringToExtended
uses the internal representation of number formatting information that was created by a prior call to StringToFormatRec
to parse the input number string. It uses the number parts table to determine the components of the number string that is being converted. StringToExtended
parses the string and then converts the string to a simple form, stripping nondigits and replacing the decimal point before converting it into a floating-point number. If the input string does not match any of the patterns, then StringToExtended
parses the string as well as it can and returns a confidence level result that indicates the parsing difficulties.
To obtain a handle to the number parts table from a tokens resource, use the GetIntlResourceTable
function.
NumberFormatting.h
Creates a number format specification string structure from a number format specification string that you supply in a Pascal string. (Deprecated in Mac OS X v10.4. Use CFNumberFormatterSetFormat
instead.)
FormatStatus StringToFormatRec ( ConstStr255Param inString, const NumberParts *partsTable, NumFormatString *outString );
A Pascal string that contains the number formatting specification.
The inString
parameter contains a number format specification string that specifies how numbers appear. This string contains up to three specifications, separated by semicolons. The positive number format is specified first, the negative number format is second, and the zero number format is last. If the string contains only one part, that is the format of all three types of numbers. If the string contains two parts, the first part is the format for positive and zero number values, and the second part is the format for negative numbers.
A pointer to a structure, usually obtained from the tokens ('itl4'
) resource, that shows the correspondence between generic number part separators (tokens) and their localized version (for example, a thousand separator is a comma in the United States and a decimal point in France).
On output, a pointer to a NumFormatStringRec
structure that contains the values that form the internal representation of the format specification. The format of the data in this structure is private.
A value that denotes the confidence level for the conversion that was performed. The low byte of the value is of type FormatResultType
. Be sure to cast the result of StringToFormatRec
to a type FormatResultType
before working with it. See the description of the FormatStatus
data type.
StringToFormatRec
converts a number format specification string into the internal representation contained in a number format string structure. It uses information in the current script’s tokens resource to determine the components of the number. StringToFormatRec
checks the validity both of the input format string and of the number parts table (since this table can be programmed by the application). StringToFormatRec
ignores spurious characters.
To obtain a handle to the number parts table from a tokens resource, use the GetIntlResourceTable
function.
StringToFormatRec
may move memory; your application should not call this function at interrupt time.
NumberFormatting.h
Converts the Pascal string representation of a base-10 number into a long integer value. (Deprecated in Mac OS X v10.4. Use CFStringGetIntValue
instead.)
void StringToNum ( ConstStr255Param theString, long *theNum );
A Pascal string representation of a base-10 number. The numeric string can be padded with leading zeros or with a sign.
On output, contains a pointer to the numeric value.
Unless patched by a script system with different rules, this function assumes that you are using standard numeric token processing, meaning that the Roman script system number processing rules are used.
For functions that make use of the token-processing information that is found in the tokens ('itl4'
) resource of script systems for converting numbers, see the sections “Using Number Format Specification Strings for International Number Formatting” and “Converting Between Strings and Floating-Point Numbers”.
The 32-bit result is negated if the string begins with a minus sign. Integer overflow occurs if the magnitude is greater than or equal to 2 raised to the 31st power. StringToNum
performs the negation using the two’s complement method: the state of each bit is reversed and then 1 is added to the result. For example, here are possible results produced by StringToNum
:
The value of theString
is “-23”. StringToNum
returns the value -23 in theNum
.
The value of theString
is “-0”. StringToNum
returns the value 0 in theNum
.
The value of theString
is “055”. StringToNum
returns the value 55 in theNum
.
The value of theString
is “2147483648” (magnitude is 2^31). StringToNum
returns the value –2147483648 in theNum
.
The value of theString
is “–2147483648”. StringToNum
returns the value –2147483648 in theNum
.
The value of theString
is “4294967295” (magnitude is 2^32–1). StringToNum
returns the value -1 in theNum
.
The value of theString
is “–4294967295”. StringToNum
returns the value 1 in theNum
.
StringToNum
does not check whether the characters in the string are between 0 and 9; instead, it takes advantage of the fact that the ASCII values for these characters are $30 through $39, and masks the last four bits for use as a digit. For example, StringToNum
converts 2: to the number 30 since the character code for the colon (:) is $3A. Because StringToNum
operates this way, spaces are treated as zeros (the character code for a space is $20), and other characters do get converted into numbers. For example, the character codes for 'C', 'A', and 'T' are $43, $41, and $54 respectively. Hence, the strings ‘CAT’, ‘+CAT’, and ‘-CAT’ would produce the results 314, 314, and -314.
One consequence of this conversion method is that StringToNum
does not ignore thousand separators (the “,” character in the United States), which can lead to improper conversions. It is a good idea to ensure that all characters in theString
are valid digits before you call StringToNum
.
StringToNum
may move memory; your application should not call this function at interrupt time.
NumberFormatting.h
Strips any diacritical marks from a text string. (Deprecated in Mac OS X v10.4. Use CFStringTransform
instead.)
void StripDiacritics ( Ptr textPtr, short len, ScriptCode script );
A pointer to the text string to be stripped.
The length, in bytes, of the text string. The text string can be up to 32 KB in length.
The script code for the script system whose rules are used for determining which character results from stripping a diacritical mark.
The conversion uses tables in the string-manipulation ('itl2'
) resource of the script specified by the value of the script
parameter. You can specify smSystemScript
to use the system script and smCurrentScript
to use the script of the current font in the current graphics port.
StripDiacritics
traverses the characters starting at the address specified by textPtr
and continues for the number of characters specified in len
. It strips any diacritical marks from the text.
If StripDiacritics
cannot access the specified resource, it generates an error code and does not modify the string. You need to call the ResError
function to determine which, if any, error occurred.
StripDiacritics
may move memory; your application should not call this function at interrupt time.
TextUtils.h
Compares two text strings, taking into account the script and language for each of the strings. (Deprecated in Mac OS X v10.4. Use CFStringCompare
or UCCompareText
instead.)
short TextOrder ( const void *aPtr, const void *bPtr, short aLen, short bLen, ScriptCode aScript, ScriptCode bScript, LangCode aLang, LangCode bLang );
A pointer to the first character of the first text string.
A pointer to the first character of the second text string.
The length, in bytes, of the first text string.
The length, in bytes, of the second text string.
The script code for the first text string.
The script code for the second text string.
The language code for the first text string.
The language code for the second text string.
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 ordering of script and language codes, which is based on information in the script-sorting resource, is considered in determining the relationship of the two strings.
This function takes both primary and secondary sorting orders into consideration and returns a value that indicates whether the first string is less than, equal to, or greater than the second string.
“Implicit Language Codes” are listed in the Constants section. Most applications specify the language code scriptCurLang
for both the aLang
and bLang
values.
TextOrder
first calls ScriptOrder
; if the result of ScriptOrder
is not 0 (that is, if the strings use different scripts), TextOrder
returns the same result.
TextOrder
next calls LanguageOrder
; if the result of LanguageOrder
is not 0 (that is, if the strings use different languages), TextOrder
returns the same result.
At this point, TextOrder
has two strings that are in the same script and language, so it compares them by using the sorting rules for that script and language, applying both the primary and secondary sorting orders. If that script is not installed and enabled, it uses the sorting rules specified by the system script or the font script, depending on the state of the international resources selection flag.
The TextOrder
function is primarily used to insert text strings in a sorted list; for sorting, rather than using this function, it may be faster to sort first by script and language by using the ScriptOrder
and LanguageOrder
functions, and then to call the CompareText
function, to sort strings within a script or language group.
TextOrder
may move memory; your application should not call this function at interrupt time.
StringCompare.h
Clears the key list and resets the type select record. (Deprecated in Mac OS X v10.4. Use UCTypeSelectFlushSelectorData
instead.)
Not recommended.
void TypeSelectClear ( TypeSelectRecord *tsr );
A pointer to the type-select record you want to clear.
The use of this function is not recommended in a Unicode-based application. If you want to use this function in an application that uses the Unicode character set, you must first convert Unicode text strings to Macintosh encoded Pascal text strings. You must also provide the encoding type or be able to determine it by extracting it from the text or by examining the system or keyboard script.
For Unicode-based applications, you should use the UCTypeSelect functions, which manipulate a UCTypeSelectRef
object. For more detalis, see Unicode Utilities (UnicodeUtilities.h
).
TypeSelect.h
Compares a text buffer to the keystroke buffer. (Deprecated in Mac OS X v10.4. Use UCTypeSelectCompare
instead.)
Not recommended.
short TypeSelectCompare ( const TypeSelectRecord *tsr, ScriptCode testStringScript, StringPtr testStringPtr );
A type select record that contains the keystroke buffer.
The script code of the test string.
A pointer to the text you want to compare to the keystroke buffer.
A numerical value that represents the ordering of the characters in the keystroke buffer with respect to the test string buffer. The value -1 is returned if characters in the keystroke buffer sort before those in testStringPtr
; 0 if characters in the keystroke buffer are the same as those in testStringPtr
, and 1 if the characters in the keystroke buffer sort after those in testStringPtr
.
The use of this function is not recommended in a Unicode-based application. If you want to use this function in an application that uses the Unicode character set, you must first convert Unicode text strings to Macintosh encoded Pascal text strings. You must also provide the encoding type or be able to determine it by extracting it from the text or by examining the system or keyboard script.
For Unicode-based applications, you should use the UCTypeSelect functions, which manipulate a UCTypeSelectRef
object. For more detalis, see Unicode Utilities (UnicodeUtilities.h
).
TypeSelect.h
Finds the closest match between a specified list of characters and the keystrokes stored in the type select record. (Deprecated in Mac OS X v10.4. Use UCTypeSelectFindItem
instead.)
Not recommended.
short TypeSelectFindItem ( const TypeSelectRecord *tsr, short listSize, TSCode selectMode, IndexToStringUPP getStringProc, void *yourDataPtr );
A pointer to the type select record that contains the keystrokes you want to compare.
The size of the list to search through.
The select mode. See Type Select Modes
for a list of the constants you can supply.
A pointer to your index-to-string callback function. See IndexToStringProcPtr
for more information.
A pointer to your data structure. This is passed to your index-to-string callback, and can be NULL
, depending on how you implement your callback function.
The use of this function is not recommended in a Unicode-based application. If you want to use this function in an application that uses the Unicode character set, you must first convert Unicode text strings to Macintosh encoded Pascal text strings. You must also provide the encoding type or be able to determine it by extracting it from the text or by examining the system or keyboard script.
For Unicode-based applications, you should use the UCTypeSelect functions, which manipulate a UCTypeSelectRef
object. For more detalis, see Unicode Utilities (UnicodeUtilities.h
).
TypeSelect.h
Creates a new type select record. (Deprecated in Mac OS X v10.4. Use UCTypeSelectCreateSelector
instead.)
Not recommended.
Boolean TypeSelectNewKey ( const EventRecord *theEvent, TypeSelectRecord *tsr );
A pointer to an event record.
A pointer to a type select record.
Returns true
if the function executed successfully; false
otherwise.
The use of this function is not recommended in a Unicode-based application. If you want to use this function in an application that uses the Unicode character set, you must first convert Unicode text strings to Macintosh encoded Pascal text strings. You must also provide the encoding type or be able to determine it by extracting it from the text or by examining the system or keyboard script.
For Unicode-based applications, you should use the UCTypeSelect functions, which manipulate a UCTypeSelectRef
object. For more detalis, see Unicode Utilities (UnicodeUtilities.h
).
TypeSelect.h
Converts any lowercase characters in a text string into their uppercase equivalents and strips any diacritical marks from the text. (Deprecated in Mac OS X v10.4. Use CFStringTransform
instead.)
void UppercaseStripDiacritics ( Ptr textPtr, short len, ScriptCode script );
A pointer to the text string to be converted.
The length, in bytes, of the text string. The text string can be up to 32 KB in length.
The script code of the script system whose resources are used to determine the results of converting characters.
The conversion uses tables in the string-manipulation ('itl2'
) resource of the script specified by the value of the script
parameter. You can specify smSystemScript
to use the system script and smCurrentScript
to use the script of the current font in the current graphics port.
UppercaseStripDiacritics
traverses the characters starting at the address specified by textPtr
and continues for the number of characters specified in len
. It converts lowercase characters in the text into their uppercase equivalents and also strips diacritical marks from the text string. This function combines the effects of the UppercaseText
and StripDiacritics
functions.
If UppercaseStripDiacritics
cannot access the specified resource, it generates an error code and does not modify the string. You need to call the ResError
function to determine which, if any, error occurred.
UppercaseStripDiacritics
may move memory; your application should not call this function at interrupt time.
TextUtils.h
Converts any lowercase characters in a text string into their uppercase equivalents. (Deprecated in Mac OS X v10.4. Use CFStringUppercase
instead.)
void UppercaseText ( Ptr textPtr, short len, ScriptCode script );
A pointer to the text string to be converted.
The length, in bytes, of the text string. The text string can be up to 32 KB in length.
The script code of the script system whose case conversion rules are used for determining uppercase character equivalents.
The conversion uses tables in the string-manipulation ('itl2'
) resource of the specified script
. You can specify smSystemScript
to use the system script and smCurrentScript
to use the script of the current font in the current graphics port.
UppercaseText
traverses the characters starting at the address specified by textPtr
and continues for the number of characters specified in len
. It converts any lowercase characters in the text into uppercase.
If UppercaseText
cannot access the specified resource, it generates an error code and does not modify the string. You need to call the ResError
function to determine which, if any, error occurred.
UppercaseText
may move memory; your application should not call this function at interrupt time.
TextUtils.h
Converts any lowercase letters in a Pascal string to their uppercase equivalents, using the Macintosh file system rules. (Deprecated in Mac OS X v10.4. Use CFStringUppercase
instead.)
void UpperString ( Str255 theString, Boolean diacSensitive );
On input, this is the Pascal string to be converted. On output, this contains the string resulting from the conversion. UpperString
traverses the characters in theString
and converts any lowercase characters with character codes in the range 0x00 through 0xD8 into their uppercase equivalents. UpperString
places the converted characters in theString
.
A flag that indicates whether the case conversion is to strip diacritical marks. If the value of this parameter is TRUE
, diacritical marks are considered in the conversion; if it is FALSE
, any diacritical marks are stripped.
Only a subset of the Roman character set (character codes with values through $D8) are converted. Use this function to emulate the behavior of the Macintosh file system.
TextUtils.h
Converts any lowercase letters in a Pascal string to their uppercase equivalents. (Deprecated in Mac OS X v10.4. Use CFStringUppercase
instead.)
Not recommended
void upperstring ( char *theString, Boolean diacSensitive );
On input, this is the Pascal string to be converted. On output, this contains the string resulting from the conversion.
A flag that indicates whether the case conversion is to strip diacritical marks. If the value of this parameter is TRUE
, diacritical marks are considered in the conversion; if it is FALSE
, any diacritical marks are stripped.
You should use the function CFStringUppercase
instead of this one.
Use UpperString
instead.
TextUtils.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-05-29)