字符串
+ (BOOL) isBlankString:(NSString *)string {
if (string == nil || string == NULL) {
return YES;
}
if ([string isKindOfClass:[NSNull class]]) {
return YES;
}
if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0) {
return YES;
}
return NO;
}
數(shù)組
if (array != nil && ![array isKindOfClass:[NSNull class]] && array.count != 0)
字典
[Dict isKindOfClass:[NSNull class]] 或者 [value isEqual:[NSNull null]]
// 或者 寫分類
if(![dict objectForKey:key]){
return NO;
}
id obj = [dict objectForKey:key];// judge NSNull
return ![obj isEqual:[NSNull null]];