rangeOfCharacter(from:)
Finds and returns the range in the string of the first character from a given character set.
Declaration
func rangeOfCharacter(from searchSet: CharacterSet) -> NSRangeParameters
- searchSet:
A character set. This value must not be
nil.Raises an Invalidargumentexception if
aSetisnil.
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:) with no options.
See Also
Finding Characters and Substrings
contains(_:)localizedCaseInsensitiveContains(_:)localizedStandardContains(_:)rangeOfCharacter(from:options:)rangeOfCharacter(from:options:range:)range(of:)range(of:options:)range(of:options:range:)range(of:options:range:locale:)localizedStandardRange(of:)enumerateLines(_:)enumerateSubstrings(in:options:using:)