Reputation: 2108
I mean get the new array simply, such as in python:
lst[:-1]
Is there any way to do it in objc?
Upvotes: 0
Views: 50
Reputation: 523374
You could use -subArrayWithRange:.
[theOriginalArray subarrayWithRange:NSMakeRange(0, [theOriginalArray count]-1)]
This is equivalent to the Python expression lst[0:lst-1]
, which is the expanded form of your lst[:-1]
.
Upvotes: 3