CHAPTER 6

image

Strings

NSString

NSString is the class used in Objective-C to work with strings. NSString manages the list of characters that forms a string. NSString objects are immutable, which means that once you create an NSString object you can’t change it.

NSString objects can be created with many different constructors, but the most common way you’ll see NSString objects created is with the @ symbol followed by quotes. In fact, you’ve seen this already in the Hello World example from Chapter 1.

NSLog(@"Hello, World!");

That parameter is an NSString object, although it’s hard to see since you don’t need the explicit NSString declaration here. ...

Get Objective-C Quick Syntax Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.