Who Should Read This Document
Organization of This Document
See Also
Strings Programming Guide for Cocoa describes how to create, search, concatenate, and draw strings. It also describes character sets, which let you search a string for characters in a group, and scanners, which convert numbers to strings and vice versa.
You should read this document if you need to work directly with strings or character sets.
This document contains the following articles:
“Strings” describes the characteristics of string objects in Cocoa.
“Creating and Converting String Objects” explains the ways in which NSString
and its subclass NSMutableString
create string objects and convert their contents to and from the various character encodings they support.
“Formatting String Objects” describes how to format NSString
objects.
“String Format Specifiers” describes printf
-style format specifiers supported by NSString
.
“Reading Strings From and Writing Strings To Files and URLs” describes how to read strings from and write strings to files and URLs.
“Searching, Comparing, and Sorting Strings” describes methods for finding characters and substrings within strings and for comparing one string to another.
“Paragraphs and Line Breaks” describes how paragraphs and line breaks are represented.
“Characters and Clusters” describes how you can break strings down into user-perceived characters.
“Character Sets” explains how to use character set objects, and how to use NSCharacterSet
methods to create standard and custom character sets.
“Scanners” describes NSScanner
objects, which interpret and convert the characters of an NSString
object into number and string values.
“String Representations of File Paths” describes the NSString
methods that manipulate strings as file-system paths.
“Drawing Strings” discusses the methods of the NSString
class that support drawing directly in an NSView
object.
For more information, refer to the following documents:
Attributed Strings Programming Guide is closely related to Strings Programming Guide for Cocoa. It provides information about NSAttributedString
objects, which manage sets of attributes, such as font and kerning, that are associated with character strings or individual characters.
Data Formatting Programming Guide for Cocoa describes how to format data using objects that create, interpret, and validate text.
Internationalization Programming Topics provides information about localizing strings in your project, including information on how string formatting arguments can be ordered.
Strings Programming Guide for Core Foundation in Core Foundation, discusses the Core Foundation opaque type CFString, which is toll-free bridged with the NSString
class.
© 1997, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)