Initializer

init(range:)

Returns a character set containing characters with Unicode values in a given range.

Declaration

init(range aRange: NSRange)

Parameters

aRange

A range of Unicode values.

aRange.location is the value of the first character to return; aRange.location + aRange.length– 1 is the value of the last.

Return Value

A character set containing characters whose Unicode values are given by aRange. If aRange.length is 0, returns an empty character set.

Discussion

This code excerpt creates a character set object containing the lowercase English alphabetic characters:

NSRange lcEnglishRange;
NSCharacterSet *lcEnglishLetters;
 
lcEnglishRange.location = (unsigned int)'a';
lcEnglishRange.length = 26;
lcEnglishLetters = [NSCharacterSet characterSetWithRange:lcEnglishRange];

See Also

Creating a Custom Character Set

init(charactersIn: String)

Returns a character set containing the characters in a given string.

NSOpenStepUnicodeReservedBase

Specifies lower bound for a Unicode character range reserved for Apple’s corporate use.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software