Created
October 2, 2009 04:01
-
-
Save jdg/199451 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by Wil Shipley | |
// from: http://www.wilshipley.com/blog/2005/10/pimp-my-code-interlude-free-code.html | |
static inline BOOL IsEmpty(id thing) { | |
return thing == nil | |
|| ([thing respondsToSelector:@selector(length)] | |
&& [(NSData *)thing length] == 0) | |
|| ([thing respondsToSelector:@selector(count)] | |
&& [(NSArray *)thing count] == 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment