Data Formatting

Convert numbers, dates, measurements, and other values to and from locale-aware string representations.

Topics

Numbers and Currency

NSNumberFormatter

A formatter that converts between numeric values and their textual representations.

Names

NSPersonNameComponentsFormatter

A formatter that provides localized representations of the components of a person’s name.

NSPersonNameComponents

An object that manages the separate parts of a person's name to allow locale-aware formatting.

Dates and Times

NSDateFormatter

A formatter that converts between dates and their textual representations.

NSDateComponentsFormatter

A formatter that creates string representations of quantities of time.

NSDateIntervalFormatter

A formatter that creates string representations of time intervals.

NSISO8601DateFormatter

A formatter that converts between dates and their ISO 8601 string representations.

Data Sizes

NSByteCountFormatter

A formatter that converts a byte count value into a localized description that is formatted with the appropriate byte modifier (KB, MB, GB and so on).

Measurements

NSMeasurementFormatter

A formatter that provides localized representations of units and measurements.

Internationalization

NSLocale

Information about linguistic, cultural, and technological conventions for use in formatting data for presentation.

Custom Formatters

NSFormatter

An abstract class that declares an interface for objects that create, interpret, and validate the textual representation of values.

Deprecated

NSLengthFormatter

A formatter that provides localized descriptions of linear distances, such as length and height measurements.

NSMassFormatter

A formatter that provides localized descriptions of mass and weight values.

NSEnergyFormatter

A formatter that provides localized descriptions of energy values.

See Also

Fundamentals

Numbers, Data, and Basic Values

Work with primitive values and other fundamental types used throughout Cocoa.

Strings and Text

Create and process strings of Unicode characters, use regular expressions to find patterns, and perform natural language analysis of text.

Collections

Use arrays, dictionaries, sets, and specialized collections to store and iterate groups of objects or values.

Dates and Times

Compare dates and times, and perform calendar and time zone calculations.

Units and Measurement

Label numeric quantities with physical dimensions to allow locale-aware formatting and conversion between related units.

Filters and Sorting

Use predicates, expressions, and sort descriptors to examine elements in collections and other services.