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.locationis the value of the first character to return;aRange.location + aRange.length – 1is 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];