NSLog

编程入门 行业动态 更新时间:2024-10-08 18:41:28
本文介绍了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

本文发布于:2023-11-27 09:53:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637586.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NSLog

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!