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


FormatRecToString

The FormatRecToString function converts an internal representation of number formatting information into a number format specification string, which can be displayed and modified.

FUNCTION FormatRecToString(myFormatRec: NumFormatStringRec;
                  partsTable: NumberParts; VAR outString: Str255;
                  VAR positions: TripleInt): FormatStatus;
myFormatRec
The internal representation of number formatting information, as created by a previous call to the StringToFormatRec function.
partsTable
A record 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, contains the number format specification string.
positions
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.
DESCRIPTION
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 syntax for this string is described in detail in "Using Number Format Specification Strings," which begins on page 5-39.

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:
Array entryWhat its value specifies
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

FormatRecToString 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 FormatRecToString to a type FormatResultType before working with it.
ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the FormatRecToString function are
Trap macroSelector
_ScriptUtil$8210 FFEA

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