Chapter 8. Strings and Primitive Values

Java and Objective-C take very similar approaches to primitive values. Both have direct language support for primitive scalar values (i.e., numbers) and arrays. Both provide a set of "wrapper" objects that encapsulate primitive values when they need to be treated as objects. Both provide syntax for declaring string object literals.

This chapter describes the classes used to "wrap" primitive values in objects and the string classes. The balance of the chapter focuses on converting and formatting strings.

Wrapping Scalar Primitives

Like Java, Objective-C variables can be broadly divided into primitive scalar values and object reference values. To pass an integer value to a method that expects an object, you must ...

Get Learn Objective-C for Java Developers 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.