6. Manipulating Strings
Objective-C provides two sorts of strings: C strings and Objective-C strings, also called string objects. As a compiler extension, GCC also lets you use Pascal strings, but these are rare and are only supported for compatibility with Pascal libraries.
A C string is a very primitive data type. It is an array of characters, terminated by a NULL
byte. It has no concept of character encodings, and can be used to store any sequence of bytes that does not contain a zero byte. UTF-8 was specifically designed to be usable with C strings: It is a variable-width encoding that does not use zero bytes, even in multibyte sequences.
An Objective-C string is a higher-level abstraction. It is accessed as a sequence of UTF-16 characters, ...
Get Objective-C Phrasebook 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.