I have an NSMutableArray of NSDictionarys something like this:
myArray (
{
chatins = 20;
placeImageString = 244211112265925;
},
{
chatins = 5;
placeImageString = 154909144575109;
},
{
chatins = 30;
placeImageString = 193867280641162;
},
{
chatins = 13;
placeImageString = 224627130902;
},
)
and another NSMutableArray of NSDictionarys something like this:
myArray2
(
{
category = "Local business";
distance = "0.1";
name = "Mts India";
placeImageString = 244211112265925;
},
{
category = "Local business";
distance = "0.17";
name = "Aegis Ltd";
placeImageString = 154909144575109;
},
{
category = "Automobiles and parts";
distance = "0.19";
name = Autopsyche;
placeImageString = 78480207511;
},
{
category = Company;
distance = "0.19";
name = "The Oberoi, Gurgaon";
placeImageString = 121676041233945;
},
)
I want to merge myArray and myArray2 in order to get resulted NSMutableArray of NSDictionarys something like below where my placeImageString is the key to match the data in both arrays of dictionaries and if the key not found in myArray2 then the value of chatins key should be 0.
myArray3
(
{
category = "Local business";
distance = "0.1";
name = "Mts India";
placeImageString = 244211112265925;
chatins = 20;
},
{
category = "Local business";
distance = "0.17";
name = "Aegis Ltd";
placeImageString = 154909144575109;
chatins = 5;
},
{
category = "Automobiles and parts";
distance = "0.19";
name = Autopsyche;
placeImageString = 78480207511;
chatins = 0;
},
{
category = Company;
distance = "0.19";
name = "The Oberoi, Gurgaon";
placeImageString = 121676041233945;
chatins = 0;
},
)
Here I have a sample code for you:
Now at the end if you check with array1, there is one more key (ADDRESS) added in all those dictionary.
Hope this help.
-Mrunal