NSString(Paragraphs) Category Reference
Declared in | NSString+Paragraphs.h |
Overview
Methods simplifying dealing with text that is in paragraphs.
The character used to separate paragraphs from each other is ‘\n’.
Instance Methods
indexIsAtBeginningOfParagraph:
Determines if the given index is the first character of a new paragraph.
- (BOOL)indexIsAtBeginningOfParagraph:(NSUInteger)index
Parameters
- index
The index to examine
Return Value
YES
if the given index is the first character of a new paragraph, NO
otherwise
Discussion
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.
Declared In
NSString+Paragraphs.h
numberOfParagraphs
Counts the number of paragraphs in the receiver
- (NSUInteger)numberOfParagraphs
Return Value
The number of paragraph characters (\n) in the receiver
Declared In
NSString+Paragraphs.h
rangeOfParagraphAtIndex:
Returns the string range of the paragraph with the given index.
- (NSRange)rangeOfParagraphAtIndex:(NSUInteger)index
Parameters
- index
The paragraph index to inspect
Return Value
The string range of the paragraph
Declared In
NSString+Paragraphs.h
rangeOfParagraphsContainingRange:parBegIndex:parEndIndex:
Extends the given range such that it contains only full paragraphs.
- (NSRange)rangeOfParagraphsContainingRange:(NSRange)range parBegIndex:(NSUInteger *)parBegIndex parEndIndex:(NSUInteger *)parEndIndex
Parameters
- range
The string range
- parBegIndex
An optional output parameter that is filled with the beginning index of the extended range
- parEndIndex
An optional output parameter that is filled with the ending index of the extended range
Return Value
The extended string range
Declared In
NSString+Paragraphs.h