---
title: "CFStringFindCharacterFromSet(_:_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfstringfindcharacterfromset(_:_:_:_:_:)"
---

# CFStringFindCharacterFromSet(_:_:_:_:_:)

Query the range of the first character contained in the specified character set.

## Declaration

```swift
func CFStringFindCharacterFromSet(_ theString: CFString!, _ theSet: CFCharacterSet!, _ rangeToSearch: CFRange, _ searchOptions: CFStringCompareFlags, _ result: UnsafeMutablePointer<CFRange>!) -> Bool
```

## Parameters

- `theString`: The string to search.
- `theSet`: The character set against which the membership of characters is checked.
- `rangeToSearch`: The range of characters within theString to search. If the range location or end point (defined by the location plus length minus 1) are outside the index space of the string (0 to N-1 inclusive, where N is the length of the string), the behavior is undefined. The specified range must not exceed the length of the string. If the range length is negative, the behavior is undefined. The range may be empty (length 0), in which case no search is performed.
- `searchOptions`: The option flags to control the search behavior. The supported options are doc://com.apple.corefoundation/documentation/CoreFoundation/CFStringCompareFlags/compareBackwards and doc://com.apple.corefoundation/documentation/CoreFoundation/CFStringCompareFlags/compareAnchored. If other option flags are specified, the behavior is undefined.
- `result`: On return, a pointer to a CFRange structure (supplied by the caller) in which the search result is stored. Note that the length of this range could be more than 1 (if the character in question is a multi-byte character). You may pass NULL if you don’t need this result.

## Return Value

Return Value true if a character in the character set is found and result is filled, false otherwise.

## See Also

### Searching Strings

- [CFStringCreateArrayWithFindResults(_:_:_:_:_:)](corefoundation/cfstringcreatearraywithfindresults(_:_:_:_:_:).md)
- [CFStringFind(_:_:_:)](corefoundation/cfstringfind(_:_:_:).md)
- [CFStringFindWithOptions(_:_:_:_:_:)](corefoundation/cfstringfindwithoptions(_:_:_:_:_:).md)
- [CFStringFindWithOptionsAndLocale(_:_:_:_:_:_:)](corefoundation/cfstringfindwithoptionsandlocale(_:_:_:_:_:_:).md)
- [CFStringGetLineBounds(_:_:_:_:_:)](corefoundation/cfstringgetlinebounds(_:_:_:_:_:).md)
