Description of NSDictionary - why are some key names with quotes?

♀尐吖头ヾ 提交于 2019-12-01 02:12:12

问题


I used a simple NSLog on a dictionary:

NSLog(@"dict %@", dictionary); 

the result was:

...
"first_name" = Peter;
gender = male;
id = 1171548848;
"last_name" = Lapisu;
...

Why are some key names in "quotes" and some not?


回答1:


When the string has characters apart from alphabets + numerics, it will quote the string.

This is the basic methodology of the description function.



来源:https://stackoverflow.com/questions/11538371/description-of-nsdictionary-why-are-some-key-names-with-quotes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!