Data Formatting

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

Topics

Numbers and Currency

class NumberFormatter

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

Names

class PersonNameComponentsFormatter

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

struct PersonNameComponents

The separate parts of a person's name, allowing locale-aware formatting.

Dates and Times

class DateFormatter

A formatter that converts between dates and their textual representations.

class DateComponentsFormatter

A formatter that creates string representations of quantities of time.

class DateIntervalFormatter

A formatter that creates string representations of time intervals.

class ISO8601DateFormatter

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

Data Sizes

class ByteCountFormatter

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

class MeasurementFormatter

A formatter that provides localized representations of units and measurements.

Internationalization

struct Locale

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

Custom Formatters

class Formatter

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

Deprecated

class LengthFormatter

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

class MassFormatter

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

class EnergyFormatter

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.