A CFCharacterSet object represents a set of Unicode compliant characters. CFString uses CFCharacterSet objects to group characters together for searching operations, so that they can find any of a particular set of characters during a search. The two opaque types, CFCharacterSet and CFMutableCharacterSet, define the interface for static and dynamic character sets, respectively. The objects you create using these opaque types are referred to as character set objects (and when no confusion will result, merely as character sets).
CFCharacterSet's principal function,
CFCharacterSetIsCharacterMember(_:_:), provides the basis for all other functions in its interface. You create a character set using one of the
CFCharacterSetCreate... functions. You may also use any one of the predefined character sets using the
CFCharacterSet is “toll-free bridged” with its Cocoa Foundation counterpart,
NSCharacterSet. This means that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. Therefore, in a method where you see an
NSCharacterSet * parameter, you can pass in a
CFCharacterSetRef, and in a function where you see a
CFCharacterSetRef parameter, you can pass in an NSCharacterSet instance. This capability also applies to concrete subclasses of NSCharacterSet. See Toll-Free Bridged Types for more information on toll-free bridging.