Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (34 sloc) 1.47 kB
//
// NSString+Paragraphs.h
// DTRichTextEditor
//
// Created by Oliver Drobnik on 11/11/11.
// Copyright (c) 2011 Cocoanetics. All rights reserved.
//
/**
Methods simplifying dealing with text that is in paragraphs.
The character used to separate paragraphs from each other is '\n'.
*/
@interface NSString (Paragraphs)
/**
Extends the given range such that it contains only full paragraphs.
@param range The string range
@param parBegIndex An optional output parameter that is filled with the beginning index of the extended range
@param parEndIndex An optional output parameter that is filled with the ending index of the extended range
@returns The extended string range
*/
- (NSRange)rangeOfParagraphsContainingRange:(NSRange)range parBegIndex:(NSUInteger *)parBegIndex parEndIndex:(NSUInteger *)parEndIndex;
/**
Determines if the given index is the first character of a new paragraph.
This is done by examining the string, index 0 or characters following a newline are considered to be a first character of a new paragraph.
@param index The index to examine
@returns `YES` if the given index is the first character of a new paragraph, `NO` otherwise
*/
- (BOOL)indexIsAtBeginningOfParagraph:(NSUInteger)index;
/**
Returns the string range of the paragraph with the given index.
@param index The paragraph index to inspect
@returns The string range of the paragraph
*/
- (NSRange)rangeOfParagraphAtIndex:(NSUInteger)index;
@end
Jump to Line
Something went wrong with that request. Please try again.