---
title: "range(at:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nstextcheckingresult/range(at:)"
---

# range(at:)

Returns the result type that the range represents.

## Declaration

```swift
func range(at idx: Int) -> NSRange
```

## Parameters

- `idx`: The index of the result.

## Return Value

Return Value The range of the result.

## Discussion

Discussion A result must have at least one range, but may optionally have more, for example, to represent regular expression capture groups. Passing range(at:) the value 0 always returns the value of the range property. Additional ranges, if any, will have indexes from 1 to numberOfRanges``-1.

## See Also

### Text Checking Type Range and Type

- [range](foundation/nstextcheckingresult/range.md)
- [resultType](foundation/nstextcheckingresult/resulttype.md)
- [numberOfRanges](foundation/nstextcheckingresult/numberofranges.md)
