---
title: "lineRange(for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsstring/linerange(for:)"
---

# lineRange(for:)

Returns the range of characters representing the line or lines containing a given range.

## Declaration

```swift
func lineRange(for range: NSRange) -> NSRange
```

## Parameters

- `range`: A range within the receiver. The value must not exceed the bounds of the receiver.

## Return Value

Return Value The range of characters representing the line or lines containing aRange, including the line termination characters. See getLineStart(_:end:contentsEnd:for:) for a discussion of line terminators.

## See Also

### Related Documentation

- [substring(with:)](foundation/nsstring/substring(with:).md)

### Determining Line and Paragraph Ranges

- [getLineStart(_:end:contentsEnd:for:)](foundation/nsstring/getlinestart(_:end:contentsend:for:).md)
- [getParagraphStart(_:end:contentsEnd:for:)](foundation/nsstring/getparagraphstart(_:end:contentsend:for:).md)
- [paragraphRange(for:)](foundation/nsstring/paragraphrange(for:).md)
