空字符串的统一处理
2016-07-11 本文已影响14人
冬日无恙
<code>
- (NSString *)replaceNullValue:(NSString *)string
{
NSString *newStr = [NSString stringWithFormat:@"%@", string];
if ([newStr isKindOfClass:[NSNull class]] ||
newStr == nil ||
[newStr isEqualToString:@"(null)"] ||
[newStr isEqualToString:@""] ||
[newStr isEqualToString:@"null"] ||
[newStr isEqualToString:@"<null>"]) {
newStr = @"";
}
return newStr;
}
</code>