---
title: "rangeOfCharacter(from:options:range:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/stringprotocol/rangeofcharacter(from:options:range:)"
---

# rangeOfCharacter(from:options:range:)

Finds and returns the range in the String of the first character from a given character set found in a given range with given options.

## Declaration

```swift
func rangeOfCharacter(from aSet: CharacterSet, options mask: String.CompareOptions = [], range aRange: Range<Self.Index>? = nil) -> Range<Self.Index>?
```
