Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSMutableCharacterSet

Inherits from
Implements
Package
com.apple.cocoa.foundation
Companion guide

Overview

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.

Tasks

Constructors

Adding and Removing Characters

Combining Character Sets

Inverting a Character Set

Constructors

NSMutableCharacterSet

Creates an empty NSMutableCharacterSet.

public NSMutableCharacterSet()

Creates a mutable character set containing characters determined by the bitmap representation data.

public NSMutableCharacterSet(NSData data)

Discussion

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)

Discussion

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)

Discussion

Returns an empty mutable character set if aString is empty.

Instance Methods

addCharacter

Adds the character aChar to the receiver.

public void addCharacter(char aChar)

See Also

addCharactersInRange

Adds the characters whose integer values are given by aRange to the receiver.

public void addCharactersInRange(NSRange aRange)

Discussion

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

addCharactersInString

Adds the characters in aString to those in the receiver.

public void addCharactersInString(String aString)

Discussion

This method has no effect if aString is empty.

See Also

intersectCharacterSet

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

public void intersectCharacterSet(NSCharacterSet otherSet)

See Also

invertCharacterSet

Replaces all the characters in the receiver with all the characters it didn’t previously contain.

public void invertCharacterSet()

removeCharacter

Removes the character aChar from the receiver.

public void removeCharacter(char aChar)

See Also

removeCharactersInRange

Removes from the receiver the characters whose integer values are given by aRange.

public void removeCharactersInRange(NSRange aRange)

Discussion

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

removeCharactersInString

Removes the characters in aString from those in the receiver.

public void removeCharactersInString(String aString)

Discussion

This method has no effect if aString is empty.

See Also

subtractCharacterSet

Removes the characters in otherSet from those in the receiver.

public void subtractCharacterSet(NSCharacterSet otherSet)

unionCharacterSet

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

public void unionCharacterSet(NSCharacterSet otherSet)

See Also


Next Page > Hide TOC


© 1997, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-07-24)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.