Ad space (banner)
๐ŸŽObjective-C Lessons
Lesson 13 / 68

The string standard library

This lesson covers Objective-C's string library, with the aim of knowing what you do not have to write yourself.

NSString provides convenient methods for handling text, such as uppercaseString and length. The Foundation framework has a rich set of string operations.

The sample code converts to upper case with [text uppercaseString] and gets the character count with [text length]. Note again the distinctive square-bracket method call.

A common early stumble is not knowing what NSString already offers and writing the same thing out at length yourself. Getting into the habit of checking the documentation for something similar is worth a great deal.

In professional work, how well you know the standard library directly affects both code quality and development speed.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run Objective-C directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)