是否有“内置函数来连接整个 NSMutableArray NSString 项目”?
是否有任何内置函数可以连接整个 NSMutableArray NSString 项目
我有一个 NSMutableArray,其结构中有 4 个元素
myArray[0] = "HI";
myArray[1] = "WELCOME";
myArray[2] = "TO";
myArray[3] = "STACKOVERFLOW";
我需要从我的 NSMutableArray(myArray) 获取句子“HI WELCOME TO STACKOVERFLOW”。
我可以知道,有任何内置函数可以做到这一点吗?
谢谢
注意:无需通过任何循环迭代数组
is there any built in function to Concatenate the whole NSMutableArray NSString items
i have an NSMutableArray with 4 elements in the following structure
myArray[0] = "HI";
myArray[1] = "WELCOME";
myArray[2] = "TO";
myArray[3] = "STACKOVERFLOW";
I need to get the sentence "HI WELCOME TO STACKOVERFLOW" from my NSMutableArray(myArray) .
may i know , any built in functions to do it?
Thanks
NB:Without iterating the array through any loop
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,有您需要的功能:
Yes, there's function you need:
是的:
Yes:
只需执行
NSString *myString = [myArray ComponentsJoinedByString:@" "];
Simply do
NSString *myString = [myArray componentsJoinedByString:@" "];