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 / Using Number Format Specification Strings for International Number Formatting


StringToFormatRec

The StringToFormatRec function creates a number format specification string record from a number format specification string that you supply in a Pascal string.

FUNCTION StringToFormatRec(inString: Str255;
               partsTable: NumberParts;
               VAR outString: NumFormatStringRec): FormatStatus;
inString
A Pascal string that contains the number formatting specification.
partsTable
A record 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).
outString
On output, this NumFormatStringRec record contains the values that form the internal representation of the format specification. The format of the data in this record is private.
DESCRIPTION
StringToFormatRec converts a number format specification string into the internal representation contained in a number format string record. 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.

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. The syntax for the number format specification strings is described in detail in "Using Number Format Specification Strings," which begins on page 5-39.

StringToFormatRec returns a value of type FormatStatus that denotes the confidence level for the conversion that it performed. The low byte of the FormatStatus value is of type FormatResultType, the values of which are described in Table 5-6 on page 5-38.

IMPORTANT
Be sure to cast the result of StringToFormatRec to a type FormatResultType before working with it.
SPECIAL CONSIDERATIONS
StringToFormatRec may move memory; your application should not call this function at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the StringToFormatRec function are
Trap macroSelector
_ScriptUtil$820C FFEC

SEE ALSO
For comprehensive details on the number parts table, see the appendix "International Resources" in this book.

To obtain a handle to the number parts table from a tokens resource, use the GetIntlResourceTable procedure, which is described in the chapter "Script Manager" in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996