NSLog - 奇怪的行为 [英] NSLog - Strange behavior

查看:104
本文介绍了NSLog - 奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现最后一个单词用双引号显示。但为什么?

I found that last word showed with double quotes. But why?

NSDictionary *guide2 = [NSDictionary dictionaryWithObjectsAndKeys:kArr, @"Kate", aArr, @"Ana-Lucia", kArr, @"John",  nil];
NSArray *array = [guide2 allKeys];
NSLog(@"%@", [array description]);

输出:

(
John,
Kate,
"Ana-Lucia"
)


推荐答案

似乎因为中的特殊字符 - c> Ana-Lucia ,它在双引号内显示​​。可能是因为表示是一个单词。如果你的密钥只包含 alphabets ,如AnaLucia,那么它将显示它而不带引号。

It seems that because of the special character - in the key Ana-Lucia, it displays it within double-quotes. May be this is because to show that the key is a single word. If your key contains only alphabets like "AnaLucia", then it will display it without quotes.

关键是如果它包含 alphabets 以外的任何字符,则以双引号显示,即使它是下划线(_)空格

The key is displayed in double-quotes if it contains any characters other than alphabets, even if it is an underscore(_) or space.

这篇关于NSLog - 奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆