Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTextCheckingResultMBS class.

NSTextCheckingResultMBS.addressComponents as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The address dictionary of a type checking result.

The dictionary keys are described in Keys for Address Components.
(Read only property)

NSTextCheckingResultMBS.components as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
A dictionary containing the components of a type checking result.
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)

Currently used by the transit checking result. The supported keys are located in Keys for Transit Components.
(Read only property)

NSTextCheckingResultMBS.date as Date

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The date component of a type checking result.
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

(Read only property)

NSTextCheckingResultMBS.dateTime as DateTime

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 20.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The date component of a type checking result.

(Read only property)

NSTextCheckingResultMBS.duration as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The duration component of a type checking result.

(Read only property)

NSTextCheckingResultMBS.Handle as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The internal object reference.

(Read and Write property)

NSTextCheckingResultMBS.numberOfRanges as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the number of ranges.

A result must have at least one range, but may optionally have more (for example, to represent regular expression capture groups).
Passing rangeAtIndex the value 0 always returns the value of the the range property. Additional ranges, if any, will have indexes from 1 to numberOfRanges-1.
(Read only property)

NSTextCheckingResultMBS.orthography as NSOrthographyMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The detected orthography of a type checking result.

(Read only property)

NSTextCheckingResultMBS.phoneNumber as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The phone number of a type checking result.
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

(Read only property)

NSTextCheckingResultMBS.range as NSRangeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the range of the result that the receiver represents.

This property will be present for all returned NSTextCheckingResultMBS instances.
(Read only property)

NSTextCheckingResultMBS.regularExpression as NSRegularExpressionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 21.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The regular expression of a type checking result.

(Read only property)

NSTextCheckingResultMBS.replacementString as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
A replacement string from one of a number of replacement checking results.

(Read only property)

NSTextCheckingResultMBS.resultType as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the text checking result type that the receiver represents.

The possible result types for the built in checking capabilities are described in NSTextCheckingType.
This property will be present for all returned NSTextCheckingResultMBS instances.
(Read only property)

NSTextCheckingResultMBS.timeZone as NSTimeZoneMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The time zone component of a type checking result.

(Read only property)

NSTextCheckingResultMBS.URL as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Regular Expressions MBS MacCocoa Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The URL of a type checking result.
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

(Read only property)

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


The biggest plugin in space...