Instance MethodFoundationEssentials
range(of:options:locale:)
iOS 15.0+
iPadOS 15.0+
Mac Catalyst 15.0+
macOS 12.0+
tvOS 15.0+
watchOS 8.0+
Returns the range of a substring in the attributed string, if it exists.
func range<T>(of stringToFind: T, options: String.CompareOptions = [], locale: Locale? = nil) -> Range<AttributedString.Index>? where T : StringProtocol
Parameters
stringToFindThe string to find.
optionsOptions that affect the search behavior, such as case-insensivity, search direction, and regular expression matching.
localeThe locale to use when searching, or
nilto use the current locale. The default isnil.