Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTextCheckingResultMBS class.

NSTextCheckingResultMBS.NSTextCheckingAllCustomTypes = &hffffffff00000000

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking type constant mask.

Checking types that can be used by clients.

NSTextCheckingResultMBS.NSTextCheckingAllSystemTypes = &hffffffff

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking type constant mask.

Checking types supported by the system. The first 32 types are reserved.

NSTextCheckingResultMBS.NSTextCheckingAllTypes = &hffffffffffffffff

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking type constant mask.

All possible checking types, both system- and user-supported.

NSTextCheckingResultMBS.NSTextCheckingTypeAddress = 16

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.
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)

Attempts to locate addresses.

NSTextCheckingResultMBS.NSTextCheckingTypeCorrection = 512

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.

Performs autocorrection on misspelled words.

NSTextCheckingResultMBS.NSTextCheckingTypeDash = 128

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.

Replaces dashes with em-dashes.

NSTextCheckingResultMBS.NSTextCheckingTypeDate = 8

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.
Example
// create detector for time, date and duration
Dim types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypeDate
Dim Error As NSErrorMBS
Dim DataDetector As NSDataDetectorMBS = NSDataDetectorMBS.dataDetectorWithTypes(types, error)

Dim s As String = "Let's meet sunday at 3 pm!"

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

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

Dim d As date = r.date
MsgBox d.SQLDateTime

Attempts to locate dates.

NSTextCheckingResultMBS.NSTextCheckingTypeGrammar = 4

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.

Checks grammar.

NSTextCheckingResultMBS.NSTextCheckingTypeLink = 32

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.
Example
// create detector for links and emails
Dim types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypeLink
Dim Error As NSErrorMBS
Dim DataDetector As New NSDataDetectorMBS(types, error)

Dim s As String = "Email us at john@mbs.test today!"

// look for the links now
Dim m() As NSTextCheckingResultMBS = DataDetector.matches(s, 0)

// show first link
Dim r As NSTextCheckingResultMBS = m(0)
MsgBox r.URL

Attempts to locate URL links or emails.

NSTextCheckingResultMBS.NSTextCheckingTypeOrthography = 1

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.

Attempts to identify the language

NSTextCheckingResultMBS.NSTextCheckingTypePhoneNumber = 2048

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.
Example
// create detector for phone number
Dim types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypePhoneNumber
Dim Error As NSErrorMBS
Dim DataDetector As New NSDataDetectorMBS(types, error)

Dim s As String = "Call us at (555)-555-555 today!"

// look for the phone number now
Dim m() As NSTextCheckingResultMBS = DataDetector.matches(s, 0)

// show first phone number found
Dim r As NSTextCheckingResultMBS = m(0)
MsgBox r.phoneNumber

Matches a phone number.

NSTextCheckingResultMBS.NSTextCheckingTypeQuote = 64

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.

Replaces quotes with smart quotes.

NSTextCheckingResultMBS.NSTextCheckingTypeRegularExpression = 1024

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.

Matches a regular expression.

NSTextCheckingResultMBS.NSTextCheckingTypeReplacement = 256

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.

Replaces characters such as (c) with the appropriate symbol (in this case ©).

NSTextCheckingResultMBS.NSTextCheckingTypeSpelling = 2

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.

Checks spelling.

NSTextCheckingResultMBS.NSTextCheckingTypeTransitInformation = 4096

Type Topic Plugin Version
const Cocoa Regular Expressions MBS MacCocoa Plugin 19.1
One of the checking types constants.
Example
// create detector for transit information
Dim types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypeTransitInformation
Dim Error As NSErrorMBS
Dim DataDetector As New NSDataDetectorMBS(types, error)

Dim s As String = "Let's fly with LH444 to Atlanta!"

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

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

Dim dic As Dictionary = r.components
Dim Airline As String = dic.Lookup(NSTextCheckingResultMBS.NSTextCheckingAirlineKey, "?")
Dim Flight As String = dic.Lookup(NSTextCheckingResultMBS.NSTextCheckingFlightKey, "?")

MsgBox Airline+" "+Flight

Matches a transit information, for example, flight information.

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


💬 Ask a question or report a problem
The biggest plugin in space...