Chapter    2

Working With Strings and Numbers

This chapter covers how to work with strings and numbers using the Foundation framework with Objective-C.

The recipes in this chapter will show you how to:

  • Create a string object using NSString
  • Read strings from text files on Mac and iOS
  • Write strings to text files on Mac and iOS
  • Compare strings
  • Manipulate strings
  • Search through strings
  • Create localized strings
  • Convert between numbers and strings
  • Format numbers for currency and other presentations

NOTE: The recipes in this chapter may be used with any Mac or iOS app that links to the Foundation framework. Follow one of the recipes from Chapter 1, such as 1.1, to set up an app to test out the code in this chapter. Be sure to locate the code in ...

Get Objective-C Recipes: A Problem-Solution Approach 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.