iOS 字符串非空判断

NSCharacterSet *set1 = [NSCharacterSet whitespaceAndNewlineCharacterSet];
    NSString *trimmedStr1 = [_str_name stringByTrimmingCharactersInSet:set1];
    if (!_str_name && [_str_name isKindOfClass:[NSNull class]] && !_str_name.length && !trimmedStr1.length){
        //字符串为空
    }else{
        //字符串不为空
    }

你可能感兴趣的:(iOS 字符串非空判断)