Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTextCheckingResultMBS class.

Checking Types

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
Var types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypeAddress
Var Error As NSErrorMBS
Var DataDetector As New NSDataDetectorMBS(types, error)

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

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

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

Var dic As Dictionary = r.components
Var 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
Var types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypeDate
Var Error As NSErrorMBS
Var DataDetector As NSDataDetectorMBS = NSDataDetectorMBS.dataDetectorWithTypes(types, error)

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

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

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

Var 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
Var types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypeLink
Var Error As NSErrorMBS
Var DataDetector As New NSDataDetectorMBS(types, error)

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

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

// show first link
Var 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
Var types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypePhoneNumber
Var Error As NSErrorMBS
Var DataDetector As New NSDataDetectorMBS(types, error)

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

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

// show first phone number found
Var 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
Var types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypeTransitInformation
Var Error As NSErrorMBS
Var DataDetector As New NSDataDetectorMBS(types, error)

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

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

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

Var dic As Dictionary = r.components
Var Airline As String = dic.Lookup(NSTextCheckingResultMBS.NSTextCheckingAirlineKey, "?")
Var 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.


The biggest plugin in space...