(BOOL) isBlankString:(NSStri...">
美文网首页
判断字符串为空 "" <null>

判断字符串为空 "" <null>

作者: 阿兹尔 | 来源:发表于2016-11-10 13:58 被阅读19次

背后台坑过
后台给的同一个数据 有 "" <null>

  • (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;
    }

相关文章

网友评论

      本文标题:判断字符串为空 "" <null>

      本文链接:https://www.haomeiwen.com/subject/fkhxpttx.html