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

The Text Utilities provide you with an integrated collection of routines for performing a variety of operations on textual information, ranging from modifying the contents of a string, to sorting strings from different languages, to converting times, dates, and numbers from internal representations to formatted strings and back. These routines work in conjunction with QuickDraw text drawing routines to help you display and modify text in applications that are distributed to an international audience.

Many of the Text Utilities routines were previously located in other managers in the Macintosh system software. Several of these have been replaced with new versions that take a script code as a parameter and others have been renamed. The appendix "Renamed and Relocated Text Routines" in this book shows the original names and locations of all of the text-handling routines.

You need to read this chapter if you are working with text in your application. This includes basic operations such as accessing a string resource and comparing two strings for equality. If you have used Macintosh text-processing routines in the past, you need to review the material in this chapter to understand the new capabilities that have been added to many of the routines.

To understand the material in this chapter, you need to have a basic understanding of the Macintosh script management system. Read this chapter after reading "Introduction to Text on the Macintosh." For parts that describe international resources, read the appendix "International Resources" along with this chapter. For parts that describe text layout, read "QuickDraw Text" along with this chapter.

This chapter describes the resources and text strings with which the Text Utilities interact, and discusses how to use the Text Utilities to compare, sort, modify, and find breaks in text strings, and to convert and format date, time, and numeric strings.


Chapter Contents
About the Text Utilities
The Text Utilities and the International Resources
Obtaining Resource Information
Pascal Strings and Text Strings
Using the Text Utilities
Defining Strings
Working With String Handles
Working With String Resources
Sorting Strings in Different Languages
Sorting Strings in the Same Language
Primary and Secondary Sorting Order
Expansion and Contraction of Characters
Ignorable Characters
Converting and Stripping Characters
Special Cases for Sorting
Variations in Sorting Behavior
Choosing a Comparison Routine
Testing Two Strings for Equality
Comparing Two Strings for Ordering
Modifying Text
Converting Characters and Stripping Marks in Strings
Fitting a String Into a Screen Area
Replacing a Portion of a String
Finding Word, Line, and Script Run Boundaries
Finding Word Boundaries
Finding Line Breaks
Finding Subscripts Within a Script Run
Working With Date and Time Strings
Converting Formatted Date and Time Strings Into Internal Numeric Representations
Date and Time Value Representations
Converting Standard Date and Time Values Into Strings
Working With Numeric Strings
Converting Between Integers and Numeric Strings
Using Number Format Specification Strings
Converting Number Format Specification Strings Into Internal Numeric Representations
Converting Between Floating-Point Numbers and Numeric Strings
Text Utilities Reference
Data Structures
Routines
Defining and Specifying Strings
Comparing Strings for Equality
Determining Sorting Order for Strings in Different Languages
Determining Sorting Order for Strings in the Same Language
Modifying Characters and Diacritical Marks
Truncating Strings
Searching for and Replacing Strings
Working With Word, Script, and Line Boundaries
Converting Date and Time Strings Into Numeric Representations
Converting Numeric Representations Into Date and Time Strings
Converting Long Date and Time Values Into Strings
Converting Between Integers and Strings
Using Number Format Specification Strings for International Number Formatting
Converting Between Strings and Floating-Point Numbers
Summary of Text Utilities
Pascal Summary
Constants
Data Types
Routines
C Summary
Constants
Types
Routines
Assembly-Language Summary
Trap Macros

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996