标签:style blog color os io ar div sp log
1 + (BOOL)isBlankString:(NSString *)string 2 { 3 if (string == nil) 4 { 5 returnYES; 6 } 7 if (string == NULL) 8 { 9 returnYES; 10 } 11 if ([string isKindOfClass:[NSNullclass]]) 12 { 13 returnYES; 14 } 15 if ([[string stringByTrimmingCharactersInSet:[NSCharacterSetwhitespaceAndNewlineCharacterSet]] length]==0) 16 { 17 returnYES; 18 } 19 returnNO; 20 } 21 22 23 24 +(Boolean) isEmptyOrNull:(NSString *) str 25 { 26 27 if (!str) 28 { 29 30 // null object 31 32 return YES; 33 34 } 35 else 36 { 37 38 NSString *trimedString = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 39 40 if ([trimedString length] == 0) 41 { 42 43 // empty string 44 45 return YES; 46 47 } 48 else 49 { 50 51 // is neither empty nor null 52 53 return NO; 54 55 } 56 57 } 58 }
标签:style blog color os io ar div sp log
原文地址:http://www.cnblogs.com/DannyApple/p/3954962.html