数组和字符串是否有值(是否为空) 判断

  1. if (array != nil && ![array isKindOfClass:[NSNull class]] && array.count != 0)  
 2 判断字符串
- (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;
}

 

posted @ 2017-07-19 14:44  宁静暖风  阅读(529)  评论(0编辑  收藏  举报