Platforms to show: All Mac Windows Linux Cross-Platform

NSCharacterSetMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
An NSCharacterSet object represents a set of Unicode-compliant characters.
// get the Symbol font
dim n as NSFontMBS = NSFontMBS.fontWithName("Symbol",10)

// what characters are defined for this font?
dim c as NSCharacterSetMBS = n.coveredCharacterSet

// display a string with all the characters
MsgBox c.StringValue

NSString and NSScanner objects use NSCharacterSet objects to group characters together for searching operations, so that they can find any of a particular set of characters during a search. The cluster's two public classes, NSCharacterSet and NSMutableCharacterSet, declare the programmatic interface for static and dynamic character sets, respectively.

The objects you create using these classes are referred to as character set objects (and when no confusion will result, merely as character sets). Because of the nature of class clusters, character set objects aren't actual instances of the NSCharacterSet or NSMutableCharacterSet classes but of one of their private subclasses. Although a character set object's class is private, its interface is public, as declared by these abstract superclasses, NSCharacterSet and NSMutableCharacterSet. The character set classes adopt the NSCopying and NSMutableCopying protocols, making it convenient to convert a character set of one type to the other.

The NSCharacterSet class declares the programmatic interface for an object that manages a set of Unicode characters (see the NSString class cluster specification for information on Unicode). NSCharacterSet's principal primitive method, characterIsMember:, provides the basis for all other instance methods in its interface. A subclass of NSCharacterSet needs only to implement this method, plus mutableCopyWithZone:, for proper behavior. For optimal performance, a subclass should also override bitmapRepresentation, which otherwise works by invoking characterIsMember: for every possible Unicode value.

NSCharacterSet is "toll-free bridged" with its Cocoa Foundation counterpart, CFCharacterSet Reference. This means that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. Therefore, in a method where you see an NSCharacterSet * parameter, you can pass a CFCharacterSetRef, and in a function where you see a CFCharacterSetRef parameter, you can pass an NSCharacterSet instance (you cast one type to the other to suppress compiler warnings). See Interchangeable Data Types for more information on toll-free bridging.

The mutable subclass of NSCharacterSet is NSMutableCharacterSet.


Constant Value Description
NSOpenStepUnicodeReservedBase &hF400 A constant to specify lower bound for a Unicode character range reserved for Apple's corporate use. Specifies lower bound for a Unicode character range reserved for Apple's corporate use (the range is 0xF400–0xF8FF).

Sub classes:

Some methods using this class:

Some properties using for this class:

Blog Entries

Xojo Developer Magazine

Release notes

  • Version 24.1

The items on this page are in the following plugins: MBS MacBase Plugin.

NSCellMBS   -   NSClipViewMBS

The biggest plugin in space...