Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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]);

output:

(
John,
Kate,
"Ana-Lucia"
)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
544 views
Welcome To Ask or Share your Answers For Others

1 Answer

Because it's not strictly alphanumeric and one word only. Try NSArray *array = [NSArray arrayWithObjects:@"abc", @"123", @"$abc", @"a-b-c", @"a b c", nil];, you'll see only the first two are not quoted. It's just an implementation choice from the guy who wrote the description code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...