Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -170,11 +170,11 @@ * \return The last object of the array or nil */ - (id)lastObject; /** - * Returns the objects from the specified index to the specified index as an + * Returns the objects from the specified index to the specified index as a new * OFArray. * * \param start The index where the subarray starts * \param end The index where the subarray ends. * This points BEHIND the last object! @@ -181,10 +181,17 @@ * \return The subarray as a new autoreleased OFArray */ - (OFArray*)objectsFromIndex: (size_t)start toIndex: (size_t)end; +/** + * Returns the objects in the specified range as a new OFArray. + * \param range The range for the subarray + * \return The subarray as a new autoreleased OFArray + */ +- (OFArray*)objectsInRange: (of_range_t)range; + /** * Creates a string by joining all objects of the array. * * \param separator The string with which the objects should be joined * \return A string containing all objects joined by the separator Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -263,10 +263,16 @@ @throw [OFOutOfRangeException newWithClass: isa]; return [OFArray arrayWithCArray: (id*)[array cArray] + start length: end - start]; } + +- (OFArray*)objectsInRange: (of_range_t)range +{ + return [self objectsFromIndex: range.start + toIndex: range.start + range.length]; +} - (OFString*)componentsJoinedByString: (OFString*)separator { OFString *str; OFString **objs = [array cArray];