数组思想:将数组中的对象的description,一个一个拼接到一个总字符串,然后输出
字典思想:遍历字典的allkeys,根据单个key,每次先拼接key的description,再拼接key对应的value的description。
#pragma mark - NSArray 和 NSDictionary的两个类目 chinese
@interface NSArray (chinese)
- (NSString *)descriptionWithLocale:(id)locale;
@end
@interface NSDictionary (chinese)
- (NSString *)descriptionWithLocale:(id)locale;
@end
@implementation NSArray (chinese)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *strM = [NSMutableString string];
[strM appendString:@"(\n"];
for (id obj in self) {
[strM appendFormat:@"\t\t%@,\n", obj];
}
[strM appendString:@")"];
return strM;
}
@end
@implementation NSDictionary (chinese)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *strM = [NSMutab