Tuesday, 15 January 2013

ios - array of dictionary comparison -


Here my application code output, this is my array dictionary value 1, array2 ..

  Array 1 (city = glendaley; country = US; cents = aja;}, {city = "glendale luke afb"; country = US; cents = aj}}, {city = goodyear; country = US; cents = aj}; , {City = phoenix; country = america; cents = az}; array 2 ({cont = US; cty = glendale; station = aj;}, {cont = US; cty = glendale; sta = ca;}, {Cont = US; cty = glendale; sta = CO;}, {cont = US; cty = glendale; sta = id;}, {cont = US; cty = glendale; sta = KY;}, {cont = US; cty = Glendale; sta = MA;}, {cont = US; cty = glendale; sta = MS;}, {cont = US; cty = glendale; sta = MO;}, {cont = US; cty = glendale; sta = NY;}, {cont = US; cty = glendale; sta = oh;}, { Cont = US; cty = glendale; sta = OR;}, {cont = US; cty = glendale; sta = RI}}, {cont = US; cty = glendale; sta = SC;}, {cont = US; cty = Glendale; sta = TX;}, {cont = US; cty = glendale; sta = UT;}, {cont = U S; cti = glendale; sta = wi;}, {cont = zw; CTI = Glendale; Sta = ""; }   

How to compare dictionary values ​​matched by the same city, state, country. Can anyone help me in solving it?

Try something like this:

 for  (array1 In id object1) {for (array2 in id2 object2) {if ((object1.cty == object2.cty) & amp; Object (object 1.cont == object2.cont) & amp; amp; (object 1 Sta == object2.sta)} {// do smth}}}   

Keep in mind, if you have the objects of NSString, then you get "code =" "= = "Instead of using isEqualToString !

No comments:

Post a Comment