【发布时间】:2011-08-18 10:43:04
【问题描述】:
将数组的前三个对象(如果数组有多大,则为 1 或 2 个)转换为逗号分隔的字符串的最有效方法是什么。我感觉有一种方法可以用积木解决这个问题,但我无法解决
对象是Bands,存储在bandArray中,每个band的属性都包含一个bandName。
所以输出会是这样的
String
"Abba" <- when there is one object
"Abba, Kiss" <- when there is two objects
"Abba, Kiss, Nirvana" <- when there is three objects
"Abba, Kiss, Nirvana" <- when there is four objects. after three, names are ignored
【问题讨论】:
标签: iphone objective-c ios nsstring nsarray