zoukankan      html  css  js  c++  java
  • 获取字典中的数组

    #import <Foundation/Foundation.h>

    int main(int argc, const char * argv[]) {

        @autoreleasepool {

        NSNumber *num=[NSNumber numberWithInt:100];

            

        NSDictionary *dic=[NSDictionary dictionaryWithObject:num  forKey:@"money"];

        

        NSDictionary *dics=[NSDictionary dictionaryWithObjectsAndKeys:@"Jay",@"name",@"22",@"age",@"F",@"gender",nil];

        NSDictionary *dic1=@{@"name":@"White",

                             @"age":@"23",

                             @"gender":@"M"};

        NSDictionary *dic2=[NSDictionary dictionaryWithDictionary:dic1];

            NSLog(@"%@",dic);

        //key-value共有多少对

            NSInteger count=[dic2 count];

            NSLog(@"count=%ld",count);

        //获取字典内value值

            NSString *name=[dic2 objectForKey:@"name"];

            NSLog(@"根据key找value--姓名:%@",name);

        //获取字典内所有的value

            NSArray *values=[dic2 allValues];

            for (id str in values) {

                NSLog(@"%@",str);

            }

        //获取字典内所有的key

            NSArray *keys=[dic2 allKeys];

            for (id str in keys) {

                NSLog(@"%@",str);

            }

        }

        return 0;

    }

  • 相关阅读:
    记ArcGIS Android V100.4加载天地图不显示的问题
    arcgis性能检测记录
    python数据更新
    python批量definition query
    从天地图下载瓦片构建本地瓦片地图
    android studio问题备注
    android studio报butterknife错误
    openPose-注
    视觉工程师现场调试手册
    human pose estimation
  • 原文地址:https://www.cnblogs.com/jidezhi/p/5120844.html
Copyright © 2011-2022 走看看