Chapter 9. Manipulating Strings
In previous chapters, you learned how to store integer and floating-point numbers in a variable. However, one of the more common types of data to store is text, otherwise known as a string.
There are two parts to a string in Objective-C. First, you must identify a string by using the @
symbol, which identifies the string as a special Objective-C string. Second, you must enclose the string inside double quotation marks, such as @"This is a string"
or @"555-1212 is also a string."
Strings can contain any characters, including numbers, symbols, and letters.
To store and manipulate strings when creating Mac programs, you use a string class called NSString
. One advantage of creating an object from an NSString
class is ...
Get Mac Programming for Absolute Beginners now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.