An object representing a fixed set of Unicode character values for use in search operations.
- iOS 2.0+
- macOS 10.0+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
NSCharacter object represents a set of Unicode-compliant characters.
NSScanner objects use
NSCharacter objects to group characters together for searching operations, so that they can find any of a particular set of characters during a search. The cluster’s two public classes,
NSMutable, declare the programmatic interface for static and dynamic character sets, respectively.
The objects you create using these classes are referred to as character set objects (and when no confusion will result, merely as character sets). Because of the nature of class clusters, character set objects aren’t actual instances of the
NSMutable classes but of one of their private subclasses. Although a character set object’s class is private, its interface is public, as declared by these abstract superclasses,
NSMutable. The character set classes adopt the
NSMutable protocols, making it convenient to convert a character set of one type to the other.
NSCharacter class declares the programmatic interface for an object that manages a set of Unicode characters (see the
NSString class cluster specification for information on Unicode).
NSCharacter’s principal primitive method,
character, provides the basis for all other instance methods in its interface. A subclass of
NSCharacter needs only to implement this method, plus
mutable, for proper behavior. For optimal performance, a subclass should also override
bitmap, which otherwise works by invoking
character for every possible Unicode value.