Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy array into another array

Tags:

iphone

I have an NSMutableArray something like this

array =[[a1,b1,c1],[a2,b2,c2],[a3,b3,c3].......]

and I access this array for particular object like

array.a =[a1,a2,a3]
array.b =[b1,b2,b3]

what I am trying to do is to copy all elements which are in array.b into an another array say arrayABC.

something like this arrayABC = [a1,a2,a3....]

HOw can i do that.. suggestions are always appreciated..

regards

like image 705
Shishir.bobby Avatar asked May 08 '26 03:05

Shishir.bobby


1 Answers

You could use the "arrayWithArray" class method in NSArray:

NSArray *newABC = [NSArray arrayWithArray:someOtherArray];

See http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html%23//apple_ref/doc/uid/20000137-BABCADBE

like image 103
Joubert Nel Avatar answered May 10 '26 20:05

Joubert Nel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!