Instance Method

rangeOfCharacter(from:options:)

Finds and returns the range in the receiver of the first character, using given options, from a given character set.

Declaration

func rangeOfCharacter(from searchSet: CharacterSet, options mask: NSString.CompareOptions = []) -> NSRange

Parameters

aSet

A character set. This value must not be nil.

Raises an NSInvalidArgumentException if aSet is nil.

mask

A mask specifying search options. The following options may be specified by combining them with the C bitwise OR operator: anchored, backwards.

Return Value

The range in the receiver of the first character found from aSet. Returns a range of {NSNotFound, 0} if none of the characters in aSet are found.

Discussion

Invokes rangeOfCharacter(from:options:range:) with mask for the options and the entire extent of the receiver for the range.