Instance Method

attributedSubstringFromRange:

Returns an NSAttributedString object consisting of the characters and attributes within a given range in the receiver.

Declaration

- (NSAttributedString *)attributedSubstringFromRange:(NSRange)range;

Parameters

aRange

The range from which to create a new attributed string. aRange must lie within the bounds of the receiver.

Return Value

An NSAttributedString object consisting of the characters and attributes within aRange in the receiver.

Discussion

Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters. This method treats the length of the string as a valid range value that returns an empty string.