PATH  Documentation > Mac OS X > Foundation Reference: Objective-C



Table of Contents

NSMutableCharacterSet


Inherits from:
NSCharacterSet : NSObject
Conforms to:
NSCopying
NSMutableCopying
NSCoding (NSCharacterSet)
NSObject (NSObject)
Declared in:
Foundation/NSCharacterSet.h




Class Description


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. They must also implement mutableCopyWithZone:.




Method Types


Adding and removing characters
- addCharactersInRange:
- removeCharactersInRange:
- addCharactersInString:
- removeCharactersInString:
Combining character sets
- formIntersectionWithCharacterSet:
- formUnionWithCharacterSet:
Inverting a character set
- invert


Instance Methods



addCharactersInRange:

- (void)addCharactersInRange:(NSRange)aRange

Adds the characters whose integer values are given by aRange to the receiver. 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.

See Also: - removeCharactersInRange:, - addCharactersInString:



addCharactersInString:

- (void)addCharactersInString:(NSString *)aString

Adds the characters in aString to those in the receiver. This method has no effect if aString is empty.

See Also: - removeCharactersInString:, - addCharactersInRange:



formIntersectionWithCharacterSet:

- (void)formIntersectionWithCharacterSet:(NSCharacterSet *)otherSet

Modifies the receiver so it contains only characters that exist in both the receiver and in otherSet.

See Also: - formUnionWithCharacterSet:



formUnionWithCharacterSet:

- (void)formUnionWithCharacterSet:(NSCharacterSet *)otherSet

Modifies the receiver so it contains all characters that exist in either the receiver or otherSet.

See Also: - formIntersectionWithCharacterSet:



invert

- (void)invert

Replaces all the characters in the receiver with all the characters it didn't previously contain. Inverting a mutable character set, whether by invert or by invertedSet, is much less efficient that inverting an immutable character set with invertedSet.

See Also: - invertedSet (NSCharacterSet)



removeCharactersInRange:

- (void)removeCharactersInRange:(NSRange)aRange

Removes from the receiver the characters whose integer values are given by 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.

See Also: - addCharactersInRange:, - removeCharactersInString:



removeCharactersInString:

- (void)removeCharactersInString:(NSString *)aString

Removes the characters in aString from those in the receiver. This method has no effect if aString is empty.

See Also: - addCharactersInString:, - removeCharactersInRange:




Table of Contents