Searches for a substring within a range of the characters represented by a string and, if the substring is found, returns its range within the object's characters.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
- Core Foundation
The string in which to to search for
The substring to search for in
A range of the characters to search in
the. The specified range must not exceed the length of the string.
On return, if the function result is
true, contains the starting location and length of the found substring. You may pass
NULLif you only want to know if the substring exists in the larger string.
true if the substring was found,
This function allows you to search only part of the characters of a string for a substring. It returns the found range indirectly, in the final
result parameter. If you want to know if the entire range of characters represented by a string contains a particular substring, you can use the convenience function
CFString. Both of these functions return upon finding the first occurrence of the substring, so if you want to find out about multiple occurrences, call the
Depending on the comparison-option flags specified, the length of the resulting range might be different than the length of the search string.