本文介绍了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
发布评论