Contents

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

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

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