美文网首页
iOS 判断字符串为空的几种方法

iOS 判断字符串为空的几种方法

作者: 花蕊1235 | 来源:发表于2017-12-14 18:24 被阅读0次

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

    }

    相关文章

      网友评论

          本文标题:iOS 判断字符串为空的几种方法

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