Instance Method

addCharactersInRange:

Adds to the receiver the characters whose Unicode values are in a given range.

Declaration

- (void)addCharactersInRange:(NSRange)aRange;

Parameters

aRange

The range of characters to add.

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.

Discussion

This code excerpt adds to a character set the lowercase English alphabetic characters:

NSMutableCharacterSet *aCharacterSet = [[NSMutableCharacterSet alloc] init];
NSRange lcEnglishRange;
 
lcEnglishRange.location = (unsigned int)'a';
lcEnglishRange.length = 26;
[aCharacterSet addCharactersInRange:lcEnglishRange];

See Also

Adding and Removing Characters

- removeCharactersInRange:

Removes from the receiver the characters whose Unicode values are in a given range.

- addCharactersInString:

Adds to the receiver the characters in a given string.

- removeCharactersInString:

Removes from the receiver the characters in a given string.