iOS小记 -- iOS之判断字符串是否为空字符的方法

2018-04-20  本文已影响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;

}

上一篇下一篇

猜你喜欢

热点阅读