Strings and Text

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

Topics

Strings

NSString

A static, plain-text Unicode string object.

NSMutableString

A dynamic plain-text Unicode string object.

Strings with Metadata

NSAttributedString

A string that has associated attributes (such as visual style, hyperlinks, or accessibility data) for portions of its text.

NSMutableAttributedString

A mutable string object that also contains attributes (such as visual style, hyperlinks, or accessibility data) associated with various portions of its text content.

Characters

NSCharacterSet

An object representing a fixed set of Unicode character values for use in search operations.

NSMutableCharacterSet

An object representing a mutable set of Unicode character values for use in search operations.

unichar

Type for UTF-16 code units.

Natural Language Processing

NSLinguisticTagger

Analyze natural language text to tag part of speech and lexical class, identify names, perform lemmatization, and determine the language and script.

Pattern Matching

NSScanner

A string parser that scans for substrings or characters in a character set, and for numeric values from decimal, hexadecimal, and floating-point representations.

NSRegularExpression

An immutable representation of a compiled regular expression that you apply to Unicode strings.

NSDataDetector

A specialized regular expression object that matches natural language text for predefined data patterns.

NSTextCheckingResult

An occurrence of textual content found during the analysis of a block of text, such as when matching a regular expression.

NSNotFound

A value indicating that a requested item couldn’t be found or doesn’t exist.

Spelling and Grammar

NSSpellServer

A server that your app uses to provide a spell checker service to other apps running in the system.

NSSpellServerDelegate

The optional methods implemented by the delegate of a spell server.

Localization

NSLocale

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

NSOrthography

A description of the linguistic content of natural language text, typically used for spelling and grammar checking.

NSLocalizedString

Returns a localized version of a string.

NSLocalizedStringFromTable

Returns a localized version of a string from the specified table.

NSLocalizedStringFromTableInBundle

Returns a localized version of a string from the specified table in the given bundle.

NSLocalizedStringWithDefaultValue

Returns a localized version of a string from the specified table in the given bundle while falling back on the given default value.

See Also

Fundamentals

Numbers, Data, and Basic Values

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

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.

Data Formatting

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

Filters and Sorting

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