NSDate NSSet

// NSString *path = @”/Users/dllo/Desktop/喜马拉雅/喜马拉雅/Ximalaya.txt”;
// NSData *data = [NSData dataWithContentsOfFile:path];
// NSMutableDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
//
// 打印复旦投毒案的shortTitle
// NSString *shorytitle = dic[@”focusImages”][@”list”][1][@”shortTitle”];
// NSLog(@”%@”,shorytitle);
//
// 打印所有的shortTitle
// NSDictionary *focusDic = dic[@”focusImages”];
// NSArray *arr = focusDic[@”list”];
// for (NSDictionary *dic in arr) {
// NSLog(@”%@”,dic[@”shortTitle”]);
// }
//
// 打印所有的title
// NSArray *arr = dic[@”recommendAlbums”][@”list”];
// for (NSDictionary *dic in arr) {
// NSLog(@”%@”,dic[@”title”]);
// }
//
// 将focusImages的list中所有type值为三的打印出来
// NSArray *arr = dic[@”focusImages”][@”list”];
// for (NSDictionary *dic in arr) {
// if ([dic[@”type”] isEqualToNumber:@3]) {
// NSLog(@”%@”,dic[@”pic”]);
// }
// }
//
//
// // 值对象
// // 把基本数据类型转化成对象类型
// // Integer -> NSNumber
// NSInteger a = 10 ;
// NSNumber *number = [[NSNumber alloc] initWithInteger:a];
// NSLog(@”%@”,number);
// // NSNumber -> Integer
// NSInteger b = [number integerValue];
// NSLog(@”%ld”,b);
//
// // NSValue
// // 把结构体和指针转化成对象类型
// // 结构体的.是访问成员变量,对象调用属性是点语法
// NSRange range = {2,5};
// NSLog(@”%ld”,range.length);
// // NSRange -> NSValue
// NSValue *value = [NSValue valueWithRange:range];
// NSLog(@”%@”,value);
// // NSValue -> NSRange
// NSRange rangeV = [value rangeValue];
// NSLog(@”%ld”,rangeV.location);
//
// int c = 10;
// int *p = &c;
// // 指针 -> NSValue
// NSValue *pointer = [NSValue valueWithPointer:p];
// NSLog(@”%@”,pointer);
// // NSValue -> 指针
// int *p1 = [pointer pointerValue];
// NSLog(@”%p”,p1);
//
// NSSet 集合
// NSSet是无序的,不能有重复的元素
// // 集合里的元素,必须是对象类型
// NSSet *set = [NSSet setWithObjects:@”1”,@”2”,@”3”,@”4”,@”5”, nil];
// NSLog(@”%@”,set);
// NSLog(@”%ld”,set.count);
// // 返回其中的一个元素
// NSLog(@”%@”,[set anyObject]);
// // 判断是否存在
// NSLog(@”%d”,[set containsObject:@”3”]);
//
// // 可变的集合
// NSMutableSet *set = [NSMutableSet setWithObjects:@”1”,@”2”,@”3”,@”4”,@”5”,nil];
// NSLog(@”%@”,set);
//
// // 添加元素
// [set addObject:@”6”];
// NSLog(@”%@”,set);
// // 删除元素
// [set removeObject:@”6”];
// NSLog(@”%@”,set);
// // 遍历
// for (NSString *str in set) {
// NSLog(@”%@”,str);
// }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值