从另一个 NSDictionary 创建 NSDictionary?
我有一个 NSDictionary
记录以下内容:
address = "30 East 23rd Street";
address1 = "30 East 23rd Street";
address2 = "";
age = 32;
alert = "";
"blood_pressure_1" = "";
"blood_pressure_2" = "";
bmi = "";
我想创建一个新的 NSDictionary,它只包含旧 NSDictionary 中的一些键,例如 age
、bmi< /code> 和
警报
。我该怎么做?
I have an NSDictionary
that logs this:
address = "30 East 23rd Street";
address1 = "30 East 23rd Street";
address2 = "";
age = 32;
alert = "";
"blood_pressure_1" = "";
"blood_pressure_2" = "";
bmi = "";
I want to create a new NSDictionary that only contains a few keys from the old one, such as just age
, bmi
, and alert
. How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这可能会更容易一些:
This might be a little easier:
显然,您可以根据需要更改密钥......
You can obviously change the keys as needed...
更容易
Even easier