打印字典和数组中的中文字符
2016-04-16 11:17
302 查看
#import <Foundation/Foundation.h>
@interface NSArray (Log)
@end
@interface NSDictionary (Log)
@end
#import "NSArray+Log.h"
@implementation NSArray (Log)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *strM = [NSMutableString
stringWithString:@"(\n"];
[self enumerateObjectsUsingBlock:^(id obj,
NSUInteger idx, BOOL *stop) {
[strM appendFormat:@"\t%@,\n", obj];
}];
[strM appendString:@")"];
return strM;
}
@end
@implementation NSDictionary (Log)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *strM = [NSMutableString
stringWithString:@"{\n"];
[self
enumerateKeysAndObjectsUsingBlock:^(id key,
id obj,
BOOL *stop) {
[strM appendFormat:@"\t%@ = %@;\n", key, obj];
}];
[strM appendString:@"}\n"];
return strM;
}
@end
@interface NSArray (Log)
@end
@interface NSDictionary (Log)
@end
#import "NSArray+Log.h"
@implementation NSArray (Log)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *strM = [NSMutableString
stringWithString:@"(\n"];
[self enumerateObjectsUsingBlock:^(id obj,
NSUInteger idx, BOOL *stop) {
[strM appendFormat:@"\t%@,\n", obj];
}];
[strM appendString:@")"];
return strM;
}
@end
@implementation NSDictionary (Log)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *strM = [NSMutableString
stringWithString:@"{\n"];
[self
enumerateKeysAndObjectsUsingBlock:^(id key,
id obj,
BOOL *stop) {
[strM appendFormat:@"\t%@ = %@;\n", key, obj];
}];
[strM appendString:@"}\n"];
return strM;
}
@end
相关文章推荐
- Thread.Sleep函数
- 用C++封装一个String
- 高仿微信新消息提示音功能
- 验证码的创建(个人见解)
- 敏捷顾问(教练)最大的误区是……
- 313. Super Ugly Number
- 奇偶数
- Redis中文乱码问题的解决
- 简单的android蓝牙通信技术(一)
- SAP标准价格修改
- unique函数的学习与应用
- phpmyadmin
- 淘宝Diamond架构分析
- C#匿名方法和Lambda表达式
- dom对象详解--document对象(一)
- SQLite3
- SDM(Supervised Descent Method)用于人脸对齐的C++实现方法
- 201. Bitwise AND of Numbers Range
- ROC和AUC介绍
- ES6 Promise