Up

# NSCharacterSet class reference

### Authors

Adam Fedor (`fedor@boulder.colorado.edu`)
Richard Frith-Macdonald (`rfm@gnu.org`)

Version: 33621

Date: 2011-07-24 07:09:22 -0600 (Sun, 24 Jul 2011)

Copyright: (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.

### Contents -

1. Software documentation for the NSCharacterSet class
2. Software documentation for the NSMutableCharacterSet class

# Software documentation for the NSCharacterSet class

## NSCharacterSet : NSObject

> Declared in:
>   Foundation/NSCharacterSet.h

> Conforms to:
>   NSCoding
>   NSCopying
>   NSMutableCopying

Availability: OpenStep
Represents a set of unicode characters. Used by NSScanner and NSString for parsing-related methods.
Method summary

- +alphanumericCharacterSet
- +capitalizedLetterCharacterSet
- +characterSetWithBitmapRepresentation:
- +characterSetWithCharactersInString:
- +characterSetWithContentsOfFile:
- +characterSetWithRange:
- +controlCharacterSet
- +decimalDigitCharacterSet
- +decomposableCharacterSet
- +illegalCharacterSet
- +letterCharacterSet
- +lowercaseLetterCharacterSet
- +newlineCharacterSet
- +nonBaseCharacterSet
- +punctuationCharacterSet
- +symbolCharacterSet
- +uppercaseLetterCharacterSet
- +whitespaceAndNewlineCharacterSet
- +whitespaceCharacterSet
- -bitmapRepresentation
- -characterIsMember:
- -hasMemberInPlane:
- -invertedSet
- -isSupersetOfSet:
- -longCharacterIsMember:

### alphanumericCharacterSet

+ (NSCharacterSet*) alphanumericCharacterSet;
Availability: OpenStep
Returns a character set containing letters, numbers, and diacritical marks. Note that "letters" includes all alphabetic as well as Chinese characters, etc..

### capitalizedLetterCharacterSet

+ (NSCharacterSet*) capitalizedLetterCharacterSet;
Availability: MacOS-X 10.0.0
Returns a character set containing letters in the unicode Titlecase category.

### characterSetWithBitmapRepresentation:

+ (NSCharacterSet*) characterSetWithBitmapRepresentation: (NSData*)data;
Availability: OpenStep
Returns a character set containing characters as encoded in the data object (8192 bytes)

### characterSetWithCharactersInString:

+ (NSCharacterSet*) characterSetWithCharactersInString: (NSString*)aString;
Availability: OpenStep
Returns set with characters in aString, or empty set for empty string. Raises an exception if given a `nil` string.

### characterSetWithContentsOfFile:

+ (NSCharacterSet*) characterSetWithContentsOfFile: (NSString*)aFile;
Availability: OPENSTEP 4.0.0 removed at MacOS-X 10.0.0
Initializes from a bitmap (8192 bytes representing 65536 values).
Each bit set in the bitmap represents the fact that a character at that position in the unicode base plane exists in the characterset.
File must have extension " `.bitmap` ". To get around this load the file into data yourself and use [NSCharacterSet -characterSetWithBitmapRepresentation].

### characterSetWithRange:

+ (NSCharacterSet*) characterSetWithRange: (NSRange)aRange;
Availability: OpenStep
Returns set containing unicode index range given by aRange.

### controlCharacterSet

+ (NSCharacterSet*) controlCharacterSet;
Availability: OpenStep
Returns a character set containing control and format characters.

### decimalDigitCharacterSet

+ (NSCharacterSet*) decimalDigitCharacterSet;
Availability: OpenStep
Returns a character set containing characters that represent the decimal digits 0 through 9.

### decomposableCharacterSet

+ (NSCharacterSet*) decomposableCharacterSet;
Availability: OpenStep
Returns a character set containing individual characters that can be represented also by a composed character sequence.

### illegalCharacterSet

+ (NSCharacterSet*) illegalCharacterSet;
Availability: OpenStep
Returns a character set containing unassigned and explicitly illegal character values.

### letterCharacterSet

+ (NSCharacterSet*) letterCharacterSet;
Availability: OpenStep
Returns a character set containing letters, including all alphabetic as well as Chinese characters, etc..

### lowercaseLetterCharacterSet

+ (NSCharacterSet*) lowercaseLetterCharacterSet;
Availability: OpenStep
Returns a character set that contains the lowercase characters. This set does not include caseless characters, only those that have corresponding characters in uppercase and/or titlecase.

### newlineCharacterSet

+ (NSCharacterSet*) newlineCharacterSet;
Availability: MacOS-X 10.0.0
Returns a character set containing the newline characters, values 0x000A and 0x000D and nextline 0x0085 character.

### nonBaseCharacterSet

+ (NSCharacterSet*) nonBaseCharacterSet;
Availability: OpenStep
Returns a character set containing characters for diacritical marks, which are usually only rendered in conjunction with another character.

### punctuationCharacterSet

+ (NSCharacterSet*) punctuationCharacterSet;
Availability: OpenStep
Returns a character set containing punctuation marks.

### symbolCharacterSet

+ (NSCharacterSet*) symbolCharacterSet;
Availability: MacOS-X 10.0.0
Returns a character set containing mathematical symbols, etc..

### uppercaseLetterCharacterSet

+ (NSCharacterSet*) uppercaseLetterCharacterSet;
Availability: OpenStep
Returns a character set that contains the uppercase characters. This set does not include caseless characters, only those that have corresponding characters in lowercase and/or titlecase.

### whitespaceAndNewlineCharacterSet

+ (NSCharacterSet*) whitespaceAndNewlineCharacterSet;
Availability: OpenStep
Returns a character set that contains the whitespace characters, plus the newline characters, values 0x000A and 0x000D and nextline 0x0085 character.

### whitespaceCharacterSet

+ (NSCharacterSet*) whitespaceCharacterSet;
Availability: OpenStep
Returns a character set that contains the whitespace characters.

### bitmapRepresentation

- (NSData*) bitmapRepresentation;
Availability: OpenStep
Returns a bitmap representation of the receiver's character set (suitable for archiving or writing to a file), in an NSData object.

### characterIsMember:

- (BOOL) characterIsMember: (unichar)aCharacter;
Availability: OpenStep
Returns `YES` if the receiver contains aCharacter, `NO` if it does not.

### hasMemberInPlane:

- (BOOL) hasMemberInPlane: (uint8_t)aPlane;
Availability: MacOS-X 10.0.0
Returns `YES` if the receiver contains at least one character in the specified unicode plane.

### invertedSet

- (NSCharacterSet*) invertedSet;
Availability: OpenStep
Returns a character set containing only characters that the receiver does not contain.

### isSupersetOfSet:

- (BOOL) isSupersetOfSet: (NSCharacterSet*)aSet;
Availability: MacOS-X 10.0.0
Returns `YES` is all the characters in aSet are present in the receiver.

### longCharacterIsMember:

- (BOOL) longCharacterIsMember: (UTF32Char)aCharacter;
Availability: MacOS-X 10.0.0
Returns `YES` is the specified 32-bit character is present in the receiver.

# Software documentation for the NSMutableCharacterSet class

## NSMutableCharacterSet : NSCharacterSet

> Declared in:
>   Foundation/NSCharacterSet.h

Availability: OpenStep
An NSCharacterSet that can be modified.
Method summary

- -addCharactersInRange:
- -addCharactersInString:
- -formIntersectionWithCharacterSet:
- -formUnionWithCharacterSet:
- -invert
- -removeCharactersInRange:
- -removeCharactersInString:

### addCharactersInRange:

- (void) addCharactersInRange: (NSRange)aRange;
Availability: OpenStep
Adds characters specified by unicode indices in aRange to set.

### addCharactersInString:

- (void) addCharactersInString: (NSString*)aString;
Availability: OpenStep
Adds characters in aString to set.

### formIntersectionWithCharacterSet:

- (void) formIntersectionWithCharacterSet: (NSCharacterSet*)otherSet;
Availability: OpenStep
Set intersection of character sets.

### formUnionWithCharacterSet:

- (void) formUnionWithCharacterSet: (NSCharacterSet*)otherSet;
Availability: OpenStep
Set union of character sets.

### invert

- (void) invert;
Availability: OpenStep
Remove all characters currently in set and add all other characters.

### removeCharactersInRange:

- (void) removeCharactersInRange: (NSRange)aRange;
Availability: OpenStep
Drop given range of characters. No error for characters not currently in set.

### removeCharactersInString:

- (void) removeCharactersInString: (NSString*)aString;
Availability: OpenStep
Drop characters in aString. No error for characters not currently in set.

Up