---
title: "getParagraphStart(_:end:contentsEnd:for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsstring/getparagraphstart(_:end:contentsend:for:)"
---

# getParagraphStart(_:end:contentsEnd:for:)

Returns by reference the beginning of the first paragraph and the end of the last paragraph touched by the given range.

## Declaration

```swift
func getParagraphStart(_ startPtr: UnsafeMutablePointer<Int>?, end parEndPtr: UnsafeMutablePointer<Int>?, contentsEnd contentsEndPtr: UnsafeMutablePointer<Int>?, for range: NSRange)
```

## Parameters

- `startPtr`: Upon return, contains the index of the first character of the paragraph containing the beginning of aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
- `parEndPtr`: Upon return, contains the index of the first character past the terminator of the paragraph containing the end of aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
- `contentsEndPtr`: Upon return, contains the index of the first character of the terminator of the paragraph containing the end of aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
- `range`: A range within the receiver. The value must not exceed the bounds of the receiver.

## Discussion

Discussion A paragraph is any segment of text delimited by a carriage return (U+000D), newline (U+000A), or paragraph separator (U+2029). If aRange is contained with a single paragraph, of course, the returned indexes all belong to that paragraph. Similar to getLineStart(_:end:contentsEnd:for:), you can use the results of this method to construct the ranges for paragraphs.

## See Also

### Determining Line and Paragraph Ranges

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