Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inamiy/yinilhandling
NSArray/NSDictionary categories to nullify/ignore nil value for iOS.
https://github.com/inamiy/yinilhandling
Last synced: 29 days ago
JSON representation
NSArray/NSDictionary categories to nullify/ignore nil value for iOS.
- Host: GitHub
- URL: https://github.com/inamiy/yinilhandling
- Owner: inamiy
- Created: 2013-02-28T08:38:57.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-02-28T08:54:50.000Z (over 11 years ago)
- Last Synced: 2024-04-15T02:56:34.215Z (7 months ago)
- Language: Objective-C
- Size: 113 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
YINilHandling
=============NSArray/NSDictionary categories to nullify/ignore nil value for iOS.
How to use
----------```
int main(int argc, const char * argv[])
{
@autoreleasepool {
static NSUInteger const count = 4;
id objects[count] = { @12345, nil, @"hoge", @"fuga" };
id keys[count] = { @0, @1, nil, nil };
// NSArray
NSArray* nullified = [NSArray arrayByNullifyingNilWithObjects:objects count:count];
NSArray* ignored = [NSArray arrayByIgnoringNilWithObjects:objects count:count];
NSLog(@"nullified array = %@",nullified); // 12345, , hoge, fuga
NSLog(@"ignored array = %@",ignored); // 12345, hoge, fuga
// NSDictionary
NSArray* nullified2 = [NSDictionary dictionaryByNullifyingNilWithObjects:objects forKeys:keys count:count];
NSArray* ignored2 = [NSDictionary dictionaryByIgnoringNilWithObjects:objects forKeys:keys count:count];
NSLog(@"nullified dictionary = %@",nullified2); // 0 = 12345, 1 =
NSLog(@"ignored dictionary = %@",ignored2); // 0 = 12345
}
return 0;
}
```License
-------
YINilHandling is available under the [Beerware](http://en.wikipedia.org/wiki/Beerware) license.If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.