Finds and returns the range of the first occurrence of a given string within the string, subject to given options.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The string to search for.
A mask specifying search options. For possible values, see
NSRange structure giving the location and length in the receiver of the first occurrence of
modulo the options in
, 0} if
is not found or is empty (
range(of: with the options specified by
mask and the entire extent of the receiver as the range.
NSString objects are compared by checking the Unicode canonical equivalence of their code point sequences. The length of the returned range and that of
may differ if equivalent composed character sequences are matched.