Instantly share code, notes, and snippets.

Embed
What would you like to do?
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