Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/Foundation.framework |
Availability | Available in Mac OS X v10.6 and later. |
Companion guide | |
Declared in | NSTextCheckingResult.h |
NSTextCheckingResult
is a class used to describe items located by text checking. Each of these objects represents something that has been found during checking–a misspelled word, a sentence with grammatical issues, a detected URL, a straight quote to be replaced with curly quotes, and so forth.
Instances of NSTextCheckingResult are returned by the NSSpellChecker
to describe the results of spelling, grammar, or substitution actions.
range
property
resultType
property
+ linkCheckingResultWithRange:URL:
URL
property
+ dateCheckingResultWithRange:date:
+ dateCheckingResultWithRange:date:timeZone:duration:
date
property
duration
property
timeZone
property
For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.
Returns a dictionary containing the address components for an NSTextCheckingTypeAddress
result. (read-only)
@property(readonly) NSDictionary *addressComponents
The dictionary keys are described in “Keys for Address Components.”
NSTextCheckingResult.h
The date detected by dateCheckingResultWithRange:date:
or dateCheckingResultWithRange:date:timeZone:duration:
(read-only)
@property(readonly) NSDate *date
NSTextCheckingResult.h
The duration detected by dateCheckingResultWithRange:date:timeZone:duration:
(read-only)
@property(readonly) NSTimeInterval duration
NSTextCheckingResult.h
The details of the grammatical error found by grammarCheckingResultWithRange:details:
(read-only)
@property(readonly) NSArray *grammarDetails
This array of strings is suitable for presenting to the user.
NSTextCheckingResult.h
The orthography detected by orthographyCheckingResultWithRange:orthography:
(read-only)
@property(readonly) NSOrthography *orthography
NSTextCheckingResult.h
Returns the range of the result that the receiver represents. (read-only)
@property(readonly) NSRange range
This property will be present for all returned NSTextCheckingResult
instances.
NSTextCheckingResult.h
A replacement string from one of a number of replacement checking results.. (read-only)
@property(readonly) NSString *replacementString
NSTextCheckingResult.h
Returns the result type that the receiver represents. (read-only)
@property(readonly) NSTextCheckingType resultType
The possible result types for the built in checking capabilities are described in “NSTextCheckingType.”
This property will be present for all returned NSTextCheckingResult
instances.
NSTextCheckingResult.h
The time zone detected by dateCheckingResultWithRange:date:timeZone:duration:
(read-only)
@property(readonly) NSTimeZone *timeZone
NSTextCheckingResult.h
Returns the URL found by a NSTextCheckingTypeLink
result. (read-only)
@property(readonly) NSURL *URL
NSTextCheckingResult.h
Creates and returns a text checking result after locating an address.
+ (NSTextCheckingResult *)addressCheckingResultWithRange:(NSRange)range components:(NSDictionary *)components
The range of the detected result.
A dictionary containing the detected address components. The dictionary keys are described in “Keys for Address Components.”
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeAddress
.
NSTextCheckingResult.h
Creates and returns a text checking result after detecting a possible correction.
+ (NSTextCheckingResult *)correctionCheckingResultWithRange:(NSRange)range replacementString:(NSString *)replacementString
The range of the detected result.
The suggested replacement string.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeSpelling
.
NSTextCheckingResult.h
Creates and returns a text checking result after locating a dash.
+ (NSTextCheckingResult *)dashCheckingResultWithRange:(NSRange)range replacementString:(NSString *)replacementString
The range of the detected result.
The replacement string.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeDash
.
NSTextCheckingResult.h
Creates and returns a text checking result as a result of locating a date.
+ (NSTextCheckingResult *)dateCheckingResultWithRange:(NSRange)rangedate:(NSDate *)date
The range of the detected result.
The detected date.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeDate
.
NSTextCheckingResult.h
Creates and returns a text checking result as a result of locating a date.
+ (NSTextCheckingResult *)dateCheckingResultWithRange:(NSRange)rangedate:(NSDate *)datetimeZone:(NSTimeZone *)timeZoneduration:(NSTimeInterval)duration
The range of the detected result.
The detected date.
The detected time zone.
The detected duration.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeDate
.
NSTextCheckingResult.h
Creates and returns a text checking result after a grammar error.
+ (NSTextCheckingResult *)grammarCheckingResultWithRange:(NSRange)range details:(NSArray *)details
The range of the detected result.
An array of details regarding the grammatical errors. This array of strings is suitable for presenting to the user.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeGrammar
.
NSTextCheckingResult.h
Creates and returns a text checking result after locating a URL link.
+ (NSTextCheckingResult *)linkCheckingResultWithRange:(NSRange)rangeURL:(NSURL *)url
The range of the detected result.
The detected URL.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeLink
.
NSTextCheckingResult.h
Creates and returns a text checking result after locating a language script.
+ (NSTextCheckingResult *)orthographyCheckingResultWithRange:(NSRange)range orthography:(NSOrthography *)orthography
The range of the detected result.
An orthograhy object that describes the script.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeOrthography
.
NSTextCheckingResult.h
Creates and returns a text checking result after locating unbalanced quotes.
+ (NSTextCheckingResult *)quoteCheckingResultWithRange:(NSRange)range replacementString:(NSString *)replacementString
The range of the detected result.
The replacement string.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeQuote
.
NSTextCheckingResult.h
Creates and returns a text checking result after locating a string that requires replacement.
+ (NSTextCheckingResult *)replacementCheckingResultWithRange:(NSRange)rangereplacementString:(NSString *)replacementString
The range of the detected result.
The replacement string.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeReplacement
.
NSTextCheckingResult.h
Creates and returns a text checking result after locating a misspelled word.
+ (NSTextCheckingResult *)spellCheckingResultWithRange:(NSRange)range
The range of the detected result.
Returns an NSTextCheckingResult
with the specified range
and a resultType
of NSTextCheckingTypeSpelling
.
NSTextCheckingResult.h
The following constants identify the possible keys returned in the addressComponents
dictionary.
NSString * const NSTextCheckingNameKey; NSString * const NSTextCheckingJobTitleKey; NSString * const NSTextCheckingOrganizationKey; NSString * const NSTextCheckingStreetKey; NSString * const NSTextCheckingCityKey; NSString * const NSTextCheckingStateKey; NSString * const NSTextCheckingZIPKey; NSString * const NSTextCheckingCountryKey; NSString * const NSTextCheckingPhoneKey;
NSTextCheckingNameKey
A key that corresponds to the name component of the address.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingJobTitleKey
A key that corresponds to the job component of the address.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingOrganizationKey
A key that corresponds to the organization component of the address.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingStreetKey
A key that corresponds to the street address component of the address.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingCityKey
A key that corresponds to the city component of the address.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingStateKey
A key that corresponds to the state or province component of the address.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingZIPKey
A key that corresponds to the zip code or postal code component of the address.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingCountryKey
A key that corresponds to the country component of the address.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingPhoneKey
A key that corresponds to the phone number component of the address.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
These constants specify the type of checking the methods should do. They are returned by resultType
.
enum { NSTextCheckingTypeOrthography = 1ULL << 0, NSTextCheckingTypeSpelling = 1ULL << 1, NSTextCheckingTypeGrammar = 1ULL << 2, NSTextCheckingTypeDate = 1ULL << 3, NSTextCheckingTypeAddress = 1ULL << 4, NSTextCheckingTypeLink = 1ULL << 5, NSTextCheckingTypeQuote = 1ULL << 6, NSTextCheckingTypeDash = 1ULL << 7, NSTextCheckingTypeReplacement = 1ULL << 8, NSTextCheckingTypeCorrection = 1ULL << 9 }; typedef uint64_t NSTextCheckingType;
NSTextCheckingTypeOrthography
Attempts to identify the language
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingTypeSpelling
Checks spelling.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingTypeGrammar
Checks grammar.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingTypeDate
Attempts to locate dates.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingTypeAddress
Attempts to locate addresses.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingTypeLink
Attempts to locate URL links.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingTypeQuote
Replaces quotes with smart quotes..
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingTypeDash
Replaces dashes with em-dashes.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingTypeReplacement
Replaces characters such as (c) with the appropriate symbol (in this case ©).
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingTypeCorrection
Performs autocorrection on misspelled words.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
Defines the types of checking that are available. The system supports its own internal types, and the user can extend those types by subclassing NSTextCheckingResult
and adding their own custom types.
enum { NSTextCheckingAllSystemTypes = 0xffffffffULL, NSTextCheckingAllCustomTypes = 0xffffffffULL << 32, purposes NSTextCheckingAllTypes = (NSTextCheckingAllSystemTypes | NSTextCheckingAllCustomTypes) }; typedef uint64_t NSTextCheckingTypes;
NSTextCheckingAllSystemTypes
Checking types supported by the system. The first 32 types are reserved.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingAllCustomTypes
Checking types that can be used by clients.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
NSTextCheckingAllTypes
All possible checking types, both system and user supported.
Available in Mac OS X v10.6 and later.
Declared in NSTextCheckingResult.h
.
Last updated: 2009-07-08