Instance Method

lineRange(for:)

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

Declaration

func lineRange(for range: NSRange) -> NSRange

Parameters

aRange

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

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

Determining Line and Paragraph Ranges

func getLineStart(UnsafeMutablePointer<Int>?, end: UnsafeMutablePointer<Int>?, contentsEnd: UnsafeMutablePointer<Int>?, for: NSRange)

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

func getParagraphStart(UnsafeMutablePointer<Int>?, end: UnsafeMutablePointer<Int>?, contentsEnd: UnsafeMutablePointer<Int>?, for: NSRange)

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

func paragraphRange(for: NSRange)

Returns the range of characters representing the paragraph or paragraphs containing a given range.