tags:

views:

36

answers:

3
(
    {

    dateVal = "nov 26, 2010";
    price = "1 - 195 kr";
},
    {

    dateVal = "nov 26, 2010";
    price = "425 - 485 kr";
},
    {

    dateVal = "nov 26, 2010";
    price = "415 - 640 kr";
})

How can i extract this NSMutableDictionay?

Help me!

A: 

It seems to be an Array which contains Dictionnary.

But Vladimir is right, how did you get this ?

To get an item from a Dictionnary, use this :

[ dictionnary objectForKey:@"keyName" ];
Vinzius
Its not working..Yes.Its an array that contains dictionary.How can i extract this?
vinay
So if it's an array, try :for (NSMutableDictionnary *dico in myArray) { NSLog(@"%@", [ dico objectForKey:@"keyName" ]); }
Vinzius
A: 

Do you mean converting from this string to NSDictionary? It looks like a JSON String for me, doesn't it?

If it is a JSON String and you want to convert to a NSDictionary, you may want to use TouchJSON, some tutorial here

vodkhang
A: 

You have plenty of choices (I suggest looking into NSArray class reference)

To get dictionary at specific index (whether dictionary you get is mutable or not depends, I think, on how have you created them and put them in array)

// make sure that index is in array bounds
NSDictionary* dict = [yourArray objectAtIndex:index]; 
NSLog(@"%@", [dict objectForKey:@"dateVal"]); // log date
NSLog(@"%@", [dict objectForKey:@"price"]); // log price

If you want to iterate through all dictionaries you have then you can use fast enumeration:

for (NSDictionary* dict in yourArray){
   ...
}
Vladimir