NSArray(GHUtils) Category Reference
| Declared in | GHNSArray+Utils.h GHNSArray+Utils.m |
Tasks
-
– gh_firstObjectFirst object or nil if array is empty.
-
– gh_randomObject:Random object in the array.
-
– gh_arrayByReversingArrayReturn new reversed array. Use reverseObjectEnumerator if you want to enumerate values in reverse.
-
– gh_subarrayWithRange:Safe subarrayWithRange that checks range. If the length is out of bounds will return all elements from location to the end. If the location is out of bounds will return nil.
-
– gh_subarrayFromLocation:Get sub-array from location to end.
-
– gh_compactRemove all instances of NSNull.
-
+ gh_arrayWithObject:Safe array with object.
-
– gh_objectAtIndex:Safe object at index.
-
– gh_objectAtIndex:withDefault:Safe object at index with default.
-
– gh_filter:Filter array.
Instance Methods
gh_arrayByReversingArray
Return new reversed array. Use reverseObjectEnumerator if you want to enumerate values in reverse.
- (NSArray *)gh_arrayByReversingArrayReturn Value
Reversed array
Declared In
GHNSArray+Utils.hgh_compact
Remove all instances of NSNull.
- (NSArray *)gh_compactReturn Value
New array with NSNull instances removed. Returns self if no NSNull’s were found.
Declared In
GHNSArray+Utils.hgh_filter:
Filter array.
- (NSArray *)gh_filter:(BOOL ( ^ ) ( id obj , NSInteger index ))filterBlockParameters
- filterBlock
Filter block
Declared In
GHNSArray+Utils.hgh_firstObject
First object or nil if array is empty.
- (id)gh_firstObjectReturn Value
Object at index 0
Declared In
GHNSArray+Utils.hgh_objectAtIndex:
Safe object at index.
- (id)gh_objectAtIndex:(NSInteger)indexParameters
- index
Index
Return Value
Object at index, or nil if index < 0 or >= count
Declared In
GHNSArray+Utils.hgh_objectAtIndex:withDefault:
Safe object at index with default.
- (id)gh_objectAtIndex:(NSInteger)index withDefault:(id)withDefaultParameters
- index
Index
- withDefault
Default if not found
Return Value
Object at index, or default value if index < 0 or >= count
Declared In
GHNSArray+Utils.hgh_randomObject:
Random object in the array.
- (id)gh_randomObject:(unsigned int)seedParameters
- seed
Seed, if 0, will use the current time to seed
Return Value
Random object
Declared In
GHNSArray+Utils.hgh_subarrayFromLocation:
Get sub-array from location to end.
- (NSArray *)gh_subarrayFromLocation:(NSInteger)locationParameters
- location
Index
Return Value
Sub-array
Declared In
GHNSArray+Utils.hgh_subarrayWithRange:
Safe subarrayWithRange that checks range. If the length is out of bounds will return all elements from location to the end. If the location is out of bounds will return nil.
- (NSArray *)gh_subarrayWithRange:(NSRange)rangeParameters
- range
Range
Return Value
Sub-array
Declared In
GHNSArray+Utils.h