开发者

how to add different object form my nsarray to nsstring

开发者 https://www.devze.com 2023-01-24 09:28 出处:网络
I am having a mutable array which has differnt value at differert index such as at index开发者_运维技巧value

I am having a mutable array which has differnt value at differert index such as at index 开发者_运维技巧 value 0 Hi 1 this 2 is 3 iphone 4 testing.

So at differnt index ,array has different string value now i want this into one string which has reads as Hi this is iphone testing.

Thanks.


You can use this:

NSArray *yourArray;
NSString *createdString = [yourArray componentsJoinedByString:@" "];

Separating array components with a space.

Here's documentation for NSArray. Here's documentation for message componentsJoinedByString.


You can append strings together with [NSString stringWithFormat:@"%@ %@ %@", string1,string2,string3];

0

精彩评论

暂无评论...
验证码 换一张
取 消