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 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.