Platforms to show: All Mac Windows Linux Cross-Platform

NSTextCheckingResultMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
An occurrence of textual content found during the analysis of a block of text, such as when matching a regular expression.
Example
// create detector for Address
Dim types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypeAddress
Dim Error As NSErrorMBS
Dim DataDetector As New NSDataDetectorMBS(types, error)

Dim s As String = "Let's meet at Hauptstraße 123 in 12345 Berlin, Deutschland."

// look for it:
Dim m() As NSTextCheckingResultMBS = DataDetector.matches(s, 0)

// show Address
Dim r As NSTextCheckingResultMBS = m(0)

Dim dic As Dictionary = r.components
Dim lines() As String
For Each key As Variant In dic.keys
lines.Append key.StringValue+": "+dic.Value(key).StringValue
Next

MsgBox Join(lines,EndOfLine)

On both iOS and macOS, instances of NSTextCheckingResultMBS are returned by the NSRegularExpression class and the NSDataDetectorMBS class to indicate the discovery of content. In those cases, what is found may be a match for a regular expression or a date, address, phone number, and so on. In macOS, instances of NSTextCheckingResultMBS are returned by the NSSpellCheckerMBS object to describe the results of spelling, grammar, or text-substitution actions.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

Checking Types

Constant Value Description
NSTextCheckingAllCustomTypes &hffffffff00000000 Checking types that can be used by clients.
NSTextCheckingAllSystemTypes &hffffffff Checking types supported by the system. The first 32 types are reserved.
NSTextCheckingAllTypes &hffffffffffffffff All possible checking types, both system- and user-supported.
NSTextCheckingTypeAddress 16 Attempts to locate addresses.
Example
NSTextCheckingTypeCorrection 512 Performs autocorrection on misspelled words.
NSTextCheckingTypeDash 128 Replaces dashes with em-dashes.
NSTextCheckingTypeDate 8 Attempts to locate dates.
Example
NSTextCheckingTypeGrammar 4 Checks grammar.
NSTextCheckingTypeLink 32 Attempts to locate URL links or emails.
Example
NSTextCheckingTypeOrthography 1 Attempts to identify the language
NSTextCheckingTypePhoneNumber 2048 Matches a phone number.
Example
NSTextCheckingTypeQuote 64 Replaces quotes with smart quotes.
NSTextCheckingTypeRegularExpression 1024 Matches a regular expression.
NSTextCheckingTypeReplacement 256 Replaces characters such as (c) with the appropriate symbol (in this case ©).
NSTextCheckingTypeSpelling 2 Checks spelling.
NSTextCheckingTypeTransitInformation 4096 Matches a transit information, for example, flight information.
Example

This class has no sub classes.

Some methods using this class:

Some events using this class:

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Release notes


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


NSTextBlockMBS   -   NSTextContainerMBS


The biggest plugin in space...