Introduction to Strings Programming Guide for Core Foundation
Core Foundation string objects give software developers a solid foundation for easy, robust, and consistent internationalization. String objects offer a full suite of fast and efficient string functionality, including utilities for converting among various encodings and buffer formats.
Read this document to learn how to use Core Foundation strings. If you are writing a program using Objective-C, you should consider using
NSString objects instead (see String Programming Guide).
Organization of This Document
This document contains the following articles:
“About Strings” describes issues related to managing and representing string
“The Unicode Basis of CFString Objects” describes the conceptual basis for the representation of strings in Core Foundation
“String Storage” describes how string data is stored in Core Foundation
“Creating and Copying Strings” describes how to create and copy string objects
“Accessing the Contents of String Objects” describes how to access the contents of CFString objects as a C or Unicode string, and how to iterate over the contents of a string one character at a time
“Comparing, Sorting, and Searching String Objects” describes how to search the contents of a string and how to compare two strings
“Manipulating Mutable String Objects” describes operations such as combining strings and padding the contents of a string.
“Converting Between String Encodings” describes how to convert between different string encodings, and what encodings are supported by CFString
“Handling External Representations of Strings” describes how to represent a string in a form that can be written to disk and read back in on the same platform or on a different platform
“Creating and Using Ranges” describes how to create and use CFRange structures
“Character Sets” describes the basics of CFCharacterSet
“String Format Specifiers” describes
printf-style format specifiers supported by CFString
Not all functions are described. Some of the functions not discussed in detail are:
CFStringGetLengthlets you obtain the number of Unicode characters represented by a
CFStringGetLineBoundstells you how many lines a string (or a range of the string) spans.
CFStringCreateByCombiningStringscreates a single string from an array (
CFArray) of strings; the counterpart of this function,
CFStringCreateArrayBySeparatingStrings, creates a
CFArrayobject from a single string, using a delimiter character to separate the substrings.
CFStringobject representing a number to the actual numeric value.