ios 判断字符串为空和只为空格解决办法 - (BOOL)isBlankString:(NSString *)string{ if (string == nil) { return YES; } if (string == NULL) { return YES; } if ([string isKindOfClass:[NSNull class]]) { return YES; } if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length]==0) { return YES; } return NO; } |
时间: 2024-12-28 18:06:40