27

What's the simplest way to extract a slice of an NSArray in Objective-C?

(much like the array_slice function in PHP)

philfreo
  • 41,941
  • 26
  • 128
  • 141
  • 4
    Your first stop should always be the documentation (http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html in this case). – Barry Wark Nov 18 '09 at 01:10

1 Answers1

51
-[NSArray subarrayWithRange:]

Reference:
https://developer.apple.com/documentation/foundation/nsarray/1415157-subarraywithrange

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ole Begemann
  • 135,006
  • 31
  • 278
  • 256