Class

NSString

A static plain-text Unicode string object.

Overview

The NSString class and its mutable subclass, NSMutableString, provide an extensive set of APIs for working with strings, including methods for comparing, searching, and modifying strings. NSString objects are used throughout Foundation and other Cocoa frameworks, serving as the basis for all textual and linguistic functionality on the platform.

NSString is “toll-free bridged” with its Core Foundation counterpart, CFStringRef. See “Toll-Free Bridging” for more information.

String Objects

An NSString object encodes a Unicode-compliant text string, represented as a sequence of UTF–16 code units. All lengths, character indexes, and ranges are expressed in terms of 16-bit platform-endian values, with index values starting at 0.

An NSString object can be initialized from or written to a C buffer, an NSData object, or the contents of an NSURL. It can also be encoded and decoded to and from ASCII, UTF–8, UTF–16, UTF–32, or any other string encoding represented by NSStringEncoding.

The objects you create using NSString and NSMutableString are referred to as string objects (or, when no confusion will result, merely as strings). The term C string refers to the standard char * type. Because of the nature of class clusters, string objects aren’t actual instances of the NSString or NSMutableString classes but of one of their private subclasses. Although a string object’s class is private, its interface is public, as declared by these abstract superclasses, NSString and NSMutableString. The string classes adopt the NSCopying and NSMutableCopying protocols, making it convenient to convert a string of one type to the other.

Understanding Characters

A string object presents itself as a sequence of UTF–16 code units. You can determine how many UTF-16 code units a string object contains with the length method and can retrieve a specific UTF-16 code unit with the characterAtIndex: method. These two “primitive” methods provide basic access to a string object.

Most use of strings, however, is at a higher level, with the strings being treated as single entities: You compare strings against one another, search them for substrings, combine them into new strings, and so on. If you need to access string objects character by character, you must understand the Unicode character encoding, specifically issues related to composed character sequences. For details see The Unicode Standard, Version 4.0 (The Unicode Consortium, Boston: Addison-Wesley, 2003, ISBN 0-321-18578-1) and the Unicode Consortium web site: http://www.unicode.org/. See also Characters and Grapheme Clusters in String Programming Guide.

Localized string comparisons are based on the Unicode Collation Algorithm, as tailored for different languages by CLDR (Common Locale Data Repository). Both are projects of the Unicode Consortium. Unicode is a registered trademark of Unicode, Inc.

Interpreting UTF-16-Encoded Data

When creating an NSString object from a UTF-16-encoded string (or a byte stream interpreted as UTF-16), if the byte order is not otherwise specified, NSString assumes that the UTF-16 characters are big-endian, unless there is a BOM (byte-order mark), in which case the BOM dictates the byte order. When creating an NSString object from an array of unichar values, the returned string is always native-endian, since the array always contains UTF–16 code units in native byte order.

Subclassing Notes

It is possible to subclass NSString (and NSMutableString), but doing so requires providing storage facilities for the string (which is not inherited by subclasses) and implementing two primitive methods. The abstract NSString and NSMutableString classes are the public interface of a class cluster consisting mostly of private, concrete classes that create and return a string object appropriate for a given situation. Making your own concrete subclass of this cluster imposes certain requirements (discussed in Methods to Override).

Make sure your reasons for subclassing NSString are valid. Instances of your subclass should represent a string and not something else. Thus the only attributes the subclass should have are the length of the character buffer it’s managing and access to individual characters in the buffer. Valid reasons for making a subclass of NSString include providing a different backing store (perhaps for better performance) or implementing some aspect of object behavior differently, such as memory management. If your purpose is to add non-essential attributes or metadata to your subclass of NSString, a better alternative would be object composition (see Alternatives to Subclassing). Cocoa already provides an example of this with the NSAttributedString class.

Methods to Override

Any subclass of NSString must override the primitive instance methods length and characterAtIndex:. These methods must operate on the backing store that you provide for the characters of the string. For this backing store you can use a static array, a dynamically allocated buffer, a standard NSString object, or some other data type or mechanism. You may also choose to override, partially or fully, any other NSString method for which you want to provide an alternative implementation. For example, for better performance it is recommended that you override getCharacters:range: and give it a faster implementation.

You might want to implement an initializer for your subclass that is suited to the backing store that the subclass is managing. The NSString class does not have a designated initializer, so your initializer need only invoke the init method of super. The NSString class adopts the NSCopying, NSMutableCopying, and NSCoding protocols; if you want instances of your own custom subclass created from copying or coding, override the methods in these protocols.

Alternatives to Subclassing

Often a better and easier alternative to making a subclass of NSString—or of any other abstract, public class of a class cluster, for that matter—is object composition. This is especially the case when your intent is to add to the subclass metadata or some other attribute that is not essential to a string object. In object composition, you would have an NSString object as one instance variable of your custom class (typically a subclass of NSObject) and one or more instance variables that store the metadata that you want for the custom object. Then just design your subclass interface to include accessor methods for the embedded string object and the metadata.

If the behavior you want to add supplements that of the existing class, you could write a category on NSString. Keep in mind, however, that this category will be in effect for all instances of NSString that you use, and this might have unintended consequences.

Topics

Creating and Initializing Strings

string

Returns an empty string.

init

Returns an initialized NSString object that contains no characters.

initWithBytes:length:encoding:

Returns an initialized NSString object containing a given number of bytes from a given buffer of bytes interpreted in a given encoding.

initWithBytesNoCopy:length:encoding:freeWhenDone:

Returns an initialized NSString object that contains a given number of bytes from a given buffer of bytes interpreted in a given encoding, and optionally frees the buffer.

initWithCharacters:length:

Returns an initialized NSString object that contains a given number of characters from a given C array of UTF-16 code units.

initWithCharactersNoCopy:length:freeWhenDone:

Returns an initialized NSString object that contains a given number of characters from a given C array of UTF-16 code units.

initWithString:

Returns an NSString object initialized by copying the characters from another given string.

initWithCString:encoding:

Returns an NSString object initialized using the characters in a given C array, interpreted according to a given encoding.

initWithUTF8String:

Returns an NSString object initialized by copying the characters from a given C array of UTF8-encoded bytes.

initWithFormat:

Returns an NSString object initialized by using a given format string as a template into which the remaining argument values are substituted.

initWithFormat:arguments:

Returns an NSString object initialized by using a given format string as a template into which the remaining argument values are substituted without any localization. This method is meant to be called from within a variadic function, where the argument list will be available.

initWithFormat:locale:

Returns an NSString object initialized by using a given format string as a template into which the remaining argument values are substituted according to given locale.

initWithFormat:locale:arguments:

Returns an NSString object initialized by using a given format string as a template into which the remaining argument values are substituted according to given locale information. This method is meant to be called from within a variadic function, where the argument list will be available.

initWithData:encoding:

Returns an NSString object initialized by converting given data into UTF-16 code units using a given encoding.

stringWithFormat:

Returns a string created by using a given format string as a template into which the remaining argument values are substituted.

localizedStringWithFormat:

Returns a string created by using a given format string as a template into which the remaining argument values are substituted according to the current locale.

localizedUserNotificationStringForKey:arguments:

Returns a localized string intended for display in a notification alert.

stringWithCharacters:length:

Returns a string containing a given number of characters taken from a given C array of UTF-16 code units.

stringWithString:

Returns a string created by copying the characters from another given string.

stringWithCString:encoding:

Returns a string containing the bytes in a given C array, interpreted according to a given encoding.

stringWithUTF8String:

Returns a string created by copying the data from a given C array of UTF8-encoded bytes.

Creating and Initializing a String from a File

stringWithContentsOfFile:encoding:error:

Returns a string created by reading data from the file at a given path interpreted using a given encoding.

initWithContentsOfFile:encoding:error:

Returns an NSString object initialized by reading data from the file at a given path using a given encoding.

stringWithContentsOfFile:usedEncoding:error:

Returns a string created by reading data from the file at a given path and returns by reference the encoding used to interpret the file.

initWithContentsOfFile:usedEncoding:error:

Returns an NSString object initialized by reading data from the file at a given path and returns by reference the encoding used to interpret the characters.

Creating and Initializing a String from an URL

stringWithContentsOfURL:encoding:error:

Returns a string created by reading data from a given URL interpreted using a given encoding.

initWithContentsOfURL:encoding:error:

Returns an NSString object initialized by reading data from a given URL interpreted using a given encoding.

stringWithContentsOfURL:usedEncoding:error:

Returns a string created by reading data from a given URL and returns by reference the encoding used to interpret the data.

initWithContentsOfURL:usedEncoding:error:

Returns an NSString object initialized by reading data from a given URL and returns by reference the encoding used to interpret the data.

Writing to a File or URL

writeToFile:atomically:encoding:error:

Writes the contents of the receiver to a file at a given path using a given encoding.

writeToURL:atomically:encoding:error:

Writes the contents of the receiver to the URL specified by url using the specified encoding.

Getting a String’s Length

length

The number of UTF-16 code units in the receiver.

lengthOfBytesUsingEncoding:

Returns the number of bytes required to store the receiver in a given encoding.

maximumLengthOfBytesUsingEncoding:

Returns the maximum number of bytes needed to store the receiver in a given encoding.

Getting Characters and Bytes

characterAtIndex:

Returns the character at a given UTF-16 code unit index.

getCharacters:range:

Copies characters from a given range in the receiver into a given buffer.

getBytes:maxLength:usedLength:encoding:options:range:remainingRange:

Gets a given range of characters as bytes in a specified encoding.

Getting C Strings

cStringUsingEncoding:

Returns a representation of the receiver as a C string using a given encoding.

getCString:maxLength:encoding:

Converts the receiver’s content to a given encoding and stores them in a buffer.

UTF8String

A null-terminated UTF8 representation of the string.

Identifying and Comparing Strings

caseInsensitiveCompare:

Returns the result of invoking compare:options: with NSCaseInsensitiveSearch as the only option.

localizedCaseInsensitiveCompare:

Compares the string with a given string using a case-insensitive, localized, comparison.

compare:

Returns the result of invoking compare:options:range: with no options and the receiver’s full extent as the range.

localizedCompare:

Compares the string and a given string using a localized comparison.

compare:options:

Compares the string with the specified string using the given options.

compare:options:range:

Returns the result of invoking compare:options:range:locale: with a nil locale.

compare:options:range:locale:

Compares the string using the specified options and returns the lexical ordering for the range.

localizedStandardCompare:

Compares strings as sorted by the Finder.

hasPrefix:

Returns a Boolean value that indicates whether a given string matches the beginning characters of the receiver.

hasSuffix:

Returns a Boolean value that indicates whether a given string matches the ending characters of the receiver.

isEqualToString:

Returns a Boolean value that indicates whether a given string is equal to the receiver using a literal Unicode-based comparison.

hash

An unsigned integer that can be used as a hash table address.

Combining Strings

stringByAppendingFormat:

Returns a string made by appending to the receiver a string constructed from a given format string and the following arguments.

stringByAppendingString:

Returns a new string made by appending a given string to the receiver.

stringByPaddingToLength:withString:startingAtIndex:

Returns a new string formed from the receiver by either removing characters from the end, or by appending as many occurrences as necessary of a given pad string.

Dividing Strings

componentsSeparatedByString:

Returns an array containing substrings from the receiver that have been divided by a given separator.

componentsSeparatedByCharactersInSet:

Returns an array containing substrings from the receiver that have been divided by characters in a given set.

stringByTrimmingCharactersInSet:

Returns a new string made by removing from both ends of the receiver characters contained in a given character set.

substringFromIndex:

Returns a new string containing the characters of the receiver from the one at a given index to the end.

substringWithRange:

Returns a string object containing the characters of the receiver that lie within a given range.

substringToIndex:

Returns a new string containing the characters of the receiver up to, but not including, the one at a given index.

Finding Characters and Substrings

containsString:

Returns whether the receiver contains a given string by performing a case-sensitive, locale-unaware search.

localizedCaseInsensitiveContainsString:

Returns whether the receiver contains a given string by performing a case-insensitive, locale-aware search.

localizedStandardContainsString:

Returns whether the receiver contains a given string by performing a case and diacritic insensitive, locale-aware search.

rangeOfCharacterFromSet:

Finds and returns the range in the receiver of the first character from a given character set.

rangeOfCharacterFromSet:options:

Finds and returns the range in the receiver of the first character, using given options, from a given character set.

rangeOfCharacterFromSet:options:range:

Finds and returns the range in the receiver of the first character from a given character set found in a given range with given options.

rangeOfString:

Finds and returns the range of the first occurrence of a given string within the receiver.

rangeOfString:options:

Finds and returns the range of the first occurrence of a given string within the receiver, subject to given options.

rangeOfString:options:range:

Finds and returns the range of the first occurrence of a given string, within the given range of the receiver, subject to given options.

rangeOfString:options:range:locale:

Finds and returns the range of the first occurrence of a given string within a given range of the receiver, subject to given options, using the specified locale, if any.

localizedStandardRangeOfString:

Finds and returns the range of the first occurrence of a given string within the receiver by performing a case and diacritic insensitive, locale-aware search.

enumerateLinesUsingBlock:

Enumerates all the lines in a string.

enumerateSubstringsInRange:options:usingBlock:

Enumerates the substrings of the specified type in the specified range of the string.

Replacing Substrings

stringByReplacingOccurrencesOfString:withString:

Returns a new string in which all occurrences of a target string in the receiver are replaced by another given string.

stringByReplacingOccurrencesOfString:withString:options:range:

Returns a new string in which all occurrences of a target string in a specified range of the receiver are replaced by another given string.

stringByReplacingCharactersInRange:withString:

Returns a new string in which the characters in a specified range of the receiver are replaced by a given string.

Determining Line and Paragraph Ranges

getLineStart:end:contentsEnd:forRange:

Returns by reference the beginning of the first line and the end of the last line touched by the given range.

lineRangeForRange:

Returns the range of characters representing the line or lines containing a given range.

getParagraphStart:end:contentsEnd:forRange:

Returns by reference the beginning of the first paragraph and the end of the last paragraph touched by the given range.

paragraphRangeForRange:

Returns the range of characters representing the paragraph or paragraphs containing a given range.

Determining Composed Character Sequences

rangeOfComposedCharacterSequenceAtIndex:

Returns the range in the receiver of the composed character sequence located at a given index.

rangeOfComposedCharacterSequencesForRange:

Returns the range in the string of the composed character sequences for a given range.

Converting String Contents Into a Property List

propertyList

Parses the receiver as a text representation of a property list, returning an NSString, NSData, NSArray, or NSDictionary object, according to the topmost element.

propertyListFromStringsFileFormat

Returns a dictionary object initialized with the keys and values found in the receiver.

Drawing Strings

drawAtPoint:withAttributes:

Draws the receiver with the font and other display characteristics of the given attributes, at the specified point in the current graphics context.

drawInRect:withAttributes:

Draws the attributed string inside the specified bounding rectangle.

drawWithRect:options:attributes:context:

Draws the attributed string in the specified bounding rectangle using the provided options.

boundingRectWithSize:options:attributes:context:

Calculates and returns the bounding rect for the receiver drawn using the given options and display characteristics, within the specified rectangle in the current graphics context.

sizeWithAttributes:

Returns the bounding box size the receiver occupies when drawn with the given attributes.

Folding Strings

stringByFoldingWithOptions:locale:

Returns a string with the given character folding options applied.

Getting a Shared Prefix

commonPrefixWithString:options:

Returns a string containing characters the receiver and a given string have in common, starting from the beginning of each up to the first characters that aren’t equivalent.

Changing Case

lowercaseString

A lowercase representation of the string.

localizedLowercaseString

Returns a version of the string with all letters converted to lowercase, taking into account the current locale.

lowercaseStringWithLocale:

Returns a version of the string with all letters converted to lowercase, taking into account the specified locale.

uppercaseString

An uppercase representation of the string.

localizedUppercaseString

Returns a version of the string with all letters converted to uppercase, taking into account the current locale.

uppercaseStringWithLocale:

Returns a version of the string with all letters converted to uppercase, taking into account the specified locale.

capitalizedString

A capitalized representation of the string.

localizedCapitalizedString

Returns a capitalized representation of the receiver using the current locale.

capitalizedStringWithLocale:

Returns a capitalized representation of the receiver using the specified locale.

Getting Strings with Mapping

decomposedStringWithCanonicalMapping

A string made by normalizing the string’s contents using the Unicode Normalization Form D.

decomposedStringWithCompatibilityMapping

A string made by normalizing the receiver’s contents using the Unicode Normalization Form KD.

precomposedStringWithCanonicalMapping

A string made by normalizing the string’s contents using the Unicode Normalization Form C.

precomposedStringWithCompatibilityMapping

A string made by normalizing the receiver’s contents using the Unicode Normalization Form KC.

Getting Numeric Values

doubleValue

The floating-point value of the string as a double.

floatValue

The floating-point value of the string as a float.

intValue

The integer value of the string.

integerValue

The NSInteger value of the string.

longLongValue

The long long value of the string.

boolValue

The Boolean value of the string.

Working with Encodings

availableStringEncodings

Returns a zero-terminated list of the encodings string objects support in the application’s environment.

defaultCStringEncoding

Returns the C-string encoding assumed for any method accepting a C string as an argument.

stringEncodingForData:encodingOptions:convertedString:usedLossyConversion:

Returns the string encoding for the given data as detected by attempting to create a string according to the specified encoding options.

localizedNameOfStringEncoding:

Returns a human-readable string giving the name of a given encoding.

canBeConvertedToEncoding:

Returns a Boolean value that indicates whether the receiver can be converted to a given encoding without loss of information.

dataUsingEncoding:

Returns an NSData object containing a representation of the receiver encoded using a given encoding.

dataUsingEncoding:allowLossyConversion:

Returns an NSData object containing a representation of the receiver encoded using a given encoding.

description

This NSString object.

fastestEncoding

The fastest encoding to which the receiver may be converted without loss of information.

smallestEncoding

The smallest encoding to which the receiver can be converted without loss of information.

Working with Paths

pathWithComponents:

Returns a string built from the strings in a given array by concatenating them with a path separator between each pair.

pathComponents

The file-system path components of the receiver.

completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:

Interprets the receiver as a path in the file system and attempts to perform filename completion, returning a numeric value that indicates whether a match was possible, and by reference the longest path that matches the receiver.

fileSystemRepresentation

A file system-specific representation of the receiver.

getFileSystemRepresentation:maxLength:

Interprets the receiver as a system-independent path and fills a buffer with a C-string in a format and encoding suitable for use with file-system calls.

absolutePath

A Boolean value that indicates whether the receiver represents an absolute path.

lastPathComponent

The last path component of the receiver.

pathExtension

The path extension, if any, of the string as interpreted as a path.

stringByAbbreviatingWithTildeInPath

A new string that replaces the current home directory portion of the current path with a tilde (~) character.

stringByAppendingPathComponent:

Returns a new string made by appending to the receiver a given string.

stringByAppendingPathExtension:

Returns a new string made by appending to the receiver an extension separator followed by a given extension.

stringByDeletingLastPathComponent

A new string made by deleting the last path component from the receiver, along with any final path separator.

stringByDeletingPathExtension

A new string made by deleting the extension (if any, and only the last) from the receiver.

stringByExpandingTildeInPath

A new string made by expanding the initial component of the receiver to its full path value.

stringByResolvingSymlinksInPath

A new string made from the receiver by resolving all symbolic links and standardizing path.

stringByStandardizingPath

A new string made by removing extraneous path components from the receiver.

stringsByAppendingPaths:

Returns an array of strings made by separately appending to the receiver each string in in a given array.

Working with URLs

stringByAddingPercentEncodingWithAllowedCharacters:

Returns a new string made from the receiver by replacing all characters not in the specified set with percent-encoded characters.

stringByRemovingPercentEncoding

Returns a new string made from the receiver by replacing all percent encoded sequences with the matching UTF-8 characters.

Linguistic Tagging and Analysis

enumerateLinguisticTagsInRange:scheme:options:orthography:usingBlock:

Performs linguistic analysis on the specified string by enumerating the specific range of the string, providing the Block with the located tags.

linguisticTagsInRange:scheme:options:orthography:tokenRanges:

Returns an array of linguistic tags for the specified range and requested tags within the receiving string.

Deprecated

stringWithCString:

Creates a new string using a given C-string.

Deprecated
initWithCString:

Initializes the receiver, a newly allocated NSString object, by converting the data in a given C-string from the default C-string encoding into the Unicode character encoding.

Deprecated
stringWithCString:length:

Returns a string containing the characters in a given C-string.

Deprecated
initWithCString:length:

Initializes the receiver, a newly allocated NSString object, by converting the data in a given C-string from the default C-string encoding into the Unicode character encoding.

Deprecated
initWithCStringNoCopy:length:freeWhenDone:

Initializes the receiver, a newly allocated NSString object, by converting the data in a given C-string from the default C-string encoding into the Unicode character encoding.

Deprecated
stringWithContentsOfFile:

Returns a string created by reading data from the file named by a given path.

Deprecated
initWithContentsOfFile:

Initializes the receiver, a newly allocated NSString object, by reading data from the file named by path.

Deprecated
stringWithContentsOfURL:

Returns a string created by reading data from the file named by a given URL.

Deprecated
initWithContentsOfURL:

Initializes the receiver, a newly allocated NSString object, by reading data from the location named by a given URL.

Deprecated
writeToFile:atomically:

Writes the contents of the receiver to the file specified by a given path.

Deprecated
writeToURL:atomically:

Writes the contents of the receiver to the location specified by a given URL.

Deprecated
getCharacters:

Copies all characters from the receiver into a given buffer.

Deprecated
cString

Returns a representation of the receiver as a C string in the default C-string encoding.

Deprecated
lossyCString

Returns a representation of the receiver as a C string in the default C-string encoding, possibly losing information in converting to that encoding.

Deprecated
cStringLength

Returns the length in char-sized units of the receiver’s C-string representation in the default C-string encoding.

Deprecated
getCString:

Invokes getCString:maxLength:range:remainingRange: with NSMaximumStringLength as the maximum length, the receiver’s entire extent as the range, and NULL for the remaining range.

Deprecated
getCString:maxLength:

Invokes getCString:maxLength:range:remainingRange: with maxLength as the maximum length in char-sized units, the receiver’s entire extent as the range, and NULL for the remaining range.

Deprecated
getCString:maxLength:range:remainingRange:

Converts the receiver’s content to the default C-string encoding and stores them in a given buffer.

Deprecated
stringByAddingPercentEscapesUsingEncoding:

Returns a representation of the receiver using a given encoding to determine the percent escapes necessary to convert the receiver into a legal URL string.

Deprecated
stringByReplacingPercentEscapesUsingEncoding:

Returns a new string made by replacing in the receiver all percent escapes with the matching characters as determined by a given encoding.

Deprecated
sizeWithFont:

Returns the size of the string if it were to be rendered with the specified font on a single line.

Deprecated
sizeWithFont:forWidth:lineBreakMode:

Returns the size of the string if it were to be rendered with the specified font and line attributes on a single line.

Deprecated
sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode:

Returns the size of the string if it were rendered with the specified constraints, including a variable font size, on a single line.

Deprecated
sizeWithFont:constrainedToSize:

Returns the size of the string if it were rendered and constrained to the specified size.

Deprecated
sizeWithFont:constrainedToSize:lineBreakMode:

Returns the size of the string if it were rendered with the specified constraints.

Deprecated
drawAtPoint:withFont:

Draws the string in a single line at the specified point in the current graphics context using the specified font.

Deprecated
drawAtPoint:forWidth:withFont:lineBreakMode:

Draws the string in a single line at the specified point in the current graphics context using the specified font and attributes.

Deprecated
drawAtPoint:forWidth:withFont:fontSize:lineBreakMode:baselineAdjustment:

Draws the string in a single line at the specified point in the current graphics context using the specified font and attributes.

Deprecated
drawAtPoint:forWidth:withFont:minFontSize:actualFontSize:lineBreakMode:baselineAdjustment:

Draws the string in a single line with the specified font and attributes, adjusting the font attributes as needed to render as much of the text as possible.

Deprecated
drawInRect:withFont:

Draws the string in the current graphics context using the specified bounding rectangle and font.

Deprecated
drawInRect:withFont:lineBreakMode:

Draws the string in the current graphics context using the specified bounding rectangle, font, and attributes.

Deprecated
drawInRect:withFont:lineBreakMode:alignment:

Draws the string in the current graphics context using the specified bounding rectangle, font and attributes.

Deprecated
drawWithRect:options:attributes:

Draws the receiver with the specified options and other display characteristics of the given attributes, within the specified rectangle in the current graphics context.

Deprecated
boundingRectWithSize:options:attributes:

Calculates and returns the bounding rect for the receiver drawn using the given options and display characteristics, within the specified rectangle in the current graphics context.

Deprecated

Constants

unichar

Type for UTF-16 code units.

NSStringCompareOptions

These values represent the options available to many of the string classes’ search and comparison methods.

NSStringEncodingConversionOptions

Options for converting string encodings.

NSStringEncoding

The following constants are provided by NSString as possible string encodings.

NSStringEnumerationOptions

Constants to specify kinds of substrings and styles of enumeration.

NSStringDrawingOptions

Constants for the rendering options for a string when it is drawn.

UIBaselineAdjustment

Vertical adjustment options.

NSString Handling Exception Names

These constants define the names of exceptions raised if NSString cannot represent a string in a given encoding, or parse a string as a property list.

String Encoding Detection Options

The following constants are provided by NSString for use when detecting string encoding from a data object.

Keys for Text Attributes Dictionaries

Keys for dictionaries that contain text attributes.

UITextAlignment

Options for aligning text horizontally.

Deprecated
UILineBreakMode

Options for wrapping and truncating text.

Deprecated
NSMaximumStringLength

A constant to define the maximum number of characters in an NSString object.

Initializers

Relationships

Inherits From

See Also

Strings

NSMutableString

A dynamic plain-text Unicode string object.