Important: The information in this document is obsolete and should not be used for new development.
Inherits from | |
Implements | |
Package | com.apple.cocoa.foundation |
Companion guide |
The 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 NSRanges 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.
addCharacter
removeCharacter
addCharactersInRange
removeCharactersInRange
addCharactersInString
removeCharactersInString
Creates an empty NSMutableCharacterSet.
public NSMutableCharacterSet
()
Creates a mutable character set containing characters determined by the bitmap representation data.
public NSMutableCharacterSet
(NSData data)
This method is useful for creating a mutable character set object with data from a file or other external data source.
Creates a mutable character set containing characters whose Unicode values are given by aRange.
public NSMutableCharacterSet
(NSRange aRange)
aRange.location
is the value of the first character, and aRange.location
+ aRange.length
– 1 is the value of the last. Returns an empty mutable character set if aRange.length
is 0.
Creates a mutable character set containing the characters in aString.
public NSMutableCharacterSet
(String aString)
Returns an empty mutable character set if aString is empty.
Adds the character aChar to the receiver.
public void addCharacter
(char aChar)
Adds the characters whose integer values are given by aRange to the receiver.
public void addCharactersInRange
(NSRange aRange)
aRange.location
is the value of the first character to add; aRange.location
+ aRange.length
– 1 is the value of the last. If aRange.length
is 0 this method has no effect.
Adds the characters in aString to those in the receiver.
public void addCharactersInString
(String aString)
This method has no effect if aString is empty.
Modifies the receiver so it contains only characters that exist in both the receiver and otherSet.
public void intersectCharacterSet
(NSCharacterSet otherSet)
Replaces all the characters in the receiver with all the characters it didn’t previously contain.
public void invertCharacterSet
()
Removes the character aChar from the receiver.
public void removeCharacter
(char aChar)
Removes from the receiver the characters whose integer values are given by aRange.
public void removeCharactersInRange
(NSRange aRange)
aRange.location
is the value of the first character to remove, and aRange.location
+ aRange.length
– 1 is the value of the last. If aRange.length
is 0 this method has no effect.
Removes the characters in aString from those in the receiver.
public void removeCharactersInString
(String aString)
This method has no effect if aString is empty.
Removes the characters in otherSet from those in the receiver.
public void subtractCharacterSet
(NSCharacterSet otherSet)
Modifies the receiver so it contains all characters that exist in either the receiver or otherSet.
public void unionCharacterSet
(NSCharacterSet otherSet)
© 1997, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-07-24)