Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSDataDetectorMBS class.

NSDataDetectorMBS.dataDetectorWithTypes(checkingTypes as Integer, byref error as NSErrorMBS) as NSDataDetectorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Regular Expressions MBS MacCocoa Plugin 21.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates and returns a new data detector instance.
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

checkingTypes: The checking types. The supported checking types are a subset of the types specified in NSTextCheckingType. Those constants can be combined using the bitwise OR operator.
error: An out parameter that if an error occurs during initialization contains the encountered error.

Returns the newly initialized data detector. If an error was encountered returns nil, and error contains the error.
Discussion
Currently, the supported data detectors checkingTypes are: NSTextCheckingTypeDate, NSTextCheckingTypeAddress, NSTextCheckingTypeLink, NSTextCheckingTypePhoneNumber, and NSTextCheckingTypeTransitInformation.

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


The biggest plugin in space...