Important: The information in this document is obsolete and should not be used for new development.
Using Number Format Specification Strings for International Number Formatting
To allow for all of the international variations in numeric presentation styles, you need to include in your routine calls a number parts table from a tokens ('itl4'
) resource. You can usually use the number parts table in the standard tokens resource that is supplied with the system. You also need to define the format of input and output numeric strings, including which characters (if any) to use as thousand separators, whether to indicate negative values with a minus sign or by enclosing the number in parentheses, and how to display zero values. These details are specified in number format specification strings, the syntax of which is described in the section "Using Number Format Specification Strings," beginning on page 5-39.To make it possible to map a number that was formatted for one specification into another format, the Macintosh Operating System defines an internal numeric representation that is independent of region, language, and other multicultural considerations: the
NumFormatStringRec
record. This record is created from a number format specification string that defines the appearance of numeric strings. Its use is summarized in Figure 5-12 on page 5-37.In brief, what you have to do is create a number format specification string that you want to use and convert that string into a
NumFormatStringRec
record. The Text Utilities include two routines for this purpose:
- The
StringToFormatRec
function converts a number format specification string into aNumFormatStringRec
record.- The
FormatRecToString
function converts the internal representation in aNumFormatStringRec
record into a number format specification string, which can be viewed and modified.
Subtopics
- StringToFormatRec
- FormatRecToString