Contents

CFStringCreateArrayWithFindResults(_:_:_:_:_:)

Searches a string for multiple occurrences of a substring and creates an array of ranges identifying the locations of these substrings within the target string.

Declaration

func CFStringCreateArrayWithFindResults(_ alloc: CFAllocator!, _ theString: CFString!, _ stringToFind: CFString!, _ rangeToSearch: CFRange, _ compareOptions: CFStringCompareFlags) -> CFArray!

Parameters

  • alloc:

    The allocator to use to allocate memory for the new CFArray object. Pass NULL or Kcfallocatordefault to use the current default allocator.

  • theString:

    The string in which to search for stringToFind.

  • stringToFind:

    The string to search for in theString.

  • rangeToSearch:

    The range of characters within theString to be searched. The specified range must not exceed the length of the string.

  • compareOptions:

    Flags that select different types of comparisons, such as localized comparison, case-insensitive comparison, and non-literal comparison. If you want the default comparison behavior, pass 0. See String Comparison Flags for the available flags.

Return Value

An array that contains pointers to CFRange structures identifying the character locations of stringToFind in theString. Returns NULL, if no matching substring is found in the source object, or if there was a problem creating the array. Ownership follows the The Create Rule.

See Also

Searching Strings