An object representing a mutable set of Unicode character values for use in search operations.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
NSMutableCharacterSet class declares the programmatic interface to objects that manage a modifiable set of Unicode characters. You can add or remove characters from a mutable character set as numeric values in
NSRange structures or as character values in strings, combine character sets by union or intersection, and invert a character set.
Mutable character sets are less efficient to use than immutable character sets. If you don’t need to change a character set after creating it, create an immutable copy with
copy and use that.
NSMutableCharacterSet defines no primitive methods. Subclasses must implement all methods declared by this class in addition to the primitives of
NSCharacterSet. They must also implement
NSMutableCharacterSet is “toll-free bridged” with its Core Foundation counterpart,
CFMutableCharacterSetRef. See Toll-Free Bridging for more information.
Getting Standard Character Sets
Returns a character set containing the characters in Unicode General Category Cc and Cf.
Returns a character set containing individual Unicode characters that can also be represented as composed character sequences (such as for letters with accents), by the definition of “standard decomposition” in version 3.2 of the Unicode character encoding standard.
Returns a character set containing values in the category of Non-Characters or that have not yet been defined in version 3.2 of the Unicode standard.
Returns a character set containing the characters in Unicode General Category L* & M*.
Returns a character set containing the newline characters (
Returns a character set containing the characters in Unicode General Category S*.
Returns a character set containing the characters in Unicode General Category Zs and
CHARACTER TABULATION (
Creating Custom Character Sets
Adding and Removing Characters
Inverting a Character Set
Replaces all the characters in the receiver with all the characters it didn’t previously contain.
An object representing a fixed set of Unicode character values for use in search operations.