Skip to content

Instantly share code, notes, and snippets.

@johnclayton
Created January 6, 2013 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnclayton/4468789 to your computer and use it in GitHub Desktop.
Save johnclayton/4468789 to your computer and use it in GitHub Desktop.
NSString empty checks
@interface NSString (FSQFoundation)
+ (BOOL) isEmpty:(NSString *)string;
+ (BOOL) isNotEmpty:(NSString *)string;
@end
@implementation NSString (FSQFoundation)
+ (BOOL) isEmpty:(NSString *)string {
return string == nil || [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length < 1;
}
+ (BOOL) isNotEmpty:(NSString *)string {
return NO == [self isEmpty:string];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment