首先,分别给数组和字典创建一个分类
然后,把下面的代码分别复制到两个分类的.m文件中即可
- (NSString *)descriptionWithLocale:(id)locale {
NSString *desc = [self.description stringByReplacingOccurrencesOfString:@"\\\"" withString:@"ms_desc_value_str1"];
desc = [desc stringByReplacingOccurrencesOfString:@"\\n" withString:@"ms_desc_value_str2"];
desc = [desc stringByReplacingOccurrencesOfString:@"\\r" withString:@"ms_desc_value_str3"];
desc = [desc stringByReplacingOccurrencesOfString:@"\"" withString:@"ms_desc_value_str4"];
desc = [NSString stringWithCString:[desc cStringUsingEncoding:NSUTF8StringEncoding] encoding:NSNonLossyASCIIStringEncoding];
desc = [desc stringByReplacingOccurrencesOfString:@"ms_desc_value_str1" withString:@"\""];
desc = [desc stringByReplacingOccurrencesOfString:@"ms_desc_value_str2" withString:@"\n"];
desc = [desc stringByReplacingOccurrencesOfString:@"ms_desc_value_str3" withString:@"\r"];
return [desc stringByReplacingOccurrencesOfString:@"ms_desc_value_str4" withString:@"\""];
}
网友评论