当输入 NSDictionary 时,属性列表中的空白值被视为什么?

发布于 2024-10-06 07:59:34 字数 471 浏览 0 评论 0原文

假设我有一个存储到 NSDictionary 中的属性列表。 NSLog 的输出示例如下:

2010-12-05 15:26:26.631 TestApp[598:207] Test contents: {
Address = "";
Name = "Test Dictionary";

Address 的值究竟会被考虑什么?我听说过很多可能性,但我不确定。是NSNullnil,什么?我最终想做的是创建第二个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荒岛晴空 2024-10-13 07:59:34

空字符串是字符串,而不是 NSNull 或 nil。因此,一种测试方法是 [@"" isEqualToString: thevalue]

An empty string is a string, not NSNull or nil. So one way to test would be [@"" isEqualToString: thevalue].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文