IOS 开发中判断字符串是否为空字符的方法

 

NSUInteger是无符号的整型, NSInteger是有符号的整型,在表视图应用中常见 NSUInteger row= [indexPath row];因为这是显示tableViewCell有多少个,只能是非零整数的,也就是说,NSUInteger常用于索引值;

 int与 NSInteger没有本质区别,只是一个定义为题

 

- (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 @ 2016-04-15 09:21  专注it  阅读(490)  评论(0)    收藏  举报