gpt4 book ai didi

iphone - 从另一个 NSDictionary 创建 NSDictionary?

转载 作者:太空狗 更新时间:2023-10-30 03:56:59 30 4
gpt4 key购买 nike

我有一个 NSDictionary 记录这个:

    address = "30 East 23rd Street";
address1 = "30 East 23rd Street";
address2 = "";
age = 32;
alert = "";
"blood_pressure_1" = "";
"blood_pressure_2" = "";
bmi = "";

我想创建一个新的 NSDictionary,它只包含旧的几个键,例如 agebmialert。我该怎么做?

最佳答案

这可能更容易一些:

NSArray *keys = [NSArray arrayWithObjects:@"address", @"address1", @"address2", nil];
NSDictionary *subset = [NSDictionary dictionaryWithObjects:
[fullDictionary objectsForKeys:keys notFoundMarker:@""]
forKeys:keys];

关于iphone - 从另一个 NSDictionary 创建 NSDictionary?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8250059/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com