当输入 NSDictionary 时,属性列表中的空白值被视为什么?
假设我有一个存储到 NSDictionary 中的属性列表。 NSLog
的输出示例如下:
2010-12-05 15:26:26.631 TestApp[598:207] Test contents: {
Address = "";
Name = "Test Dictionary";
Address 的值究竟会被考虑什么?我听说过很多可能性,但我不确定。是NSNull
,nil
,什么?我最终想做的是创建第二个 NSDictionary 来过滤掉所有这些空白值,如 此处。但首先,我需要弄清楚空白值被算作什么,这样我就可以解析它们的 plist,然后折扣与它们关联的键。
Say I have a property list that I store into an NSDictionary
. An example output from NSLog
follows:
2010-12-05 15:26:26.631 TestApp[598:207] Test contents: {
Address = "";
Name = "Test Dictionary";
What exactly would the value for Address be considered? I have heard many possibilities, but I'm not sure exactly. Is it NSNull
, nil
, what? What I would ultimately like to do is to create a second NSDictionary
that filters out all of these blank values, as seen here. But first, I need to figure out what the blank value is counted as, so then I can parse my plist for them, and then discount the keys associated with them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
空字符串是字符串,而不是 NSNull 或 nil。因此,一种测试方法是
[@"" isEqualToString: thevalue]
。An empty string is a string, not NSNull or nil. So one way to test would be
[@"" isEqualToString: thevalue]
.