分享个工具类——判断字符串是否为空

2016-11-08  本文已影响27人  香蕉你个菠萝

#pragma mark判断字符串是否为空

+(BOOL) isBlankString:(NSString*)string {

NSString*astring = string;

astring = [astringstringByTrimmingCharactersInSet:[NSCharacterSetwhitespaceCharacterSet]];

if(astring ==nil|| astring ==NULL) {

returnYES;

}

if([astringisEqualToString:@"\n"]) {

returnYES;

}

if([astringisKindOfClass:[NSNullclass]]) {

returnYES;

}

if([[astringstringByTrimmingCharactersInSet:[NSCharacterSetwhitespaceCharacterSet]]length]==0) {

returnYES;

}

returnNO;

}

上一篇下一篇

猜你喜欢

热点阅读