views:

61

answers:

1

hi guys, i have some string date which is coming from xml RSS feed. what I want to do is to add these string into nsarray. the code is

NSString *headline=[[blogEntries objectAtIndex: blogEntryIndex1] objectForKey: @"title"];

now i want to store this string into nsarray. as i am implementing searchbar in uitableview can anybody help me please.

Thanks in advance

hey guys I have done it the code is

NSArray *theArray = [headline componentsSeparatedByString:@","];
A: 

To store the one string, you would want:

NSArray *myArray = [NSArray arrayWithObject:headline];

To store more than one object:

NSArray *myArray = [NSArray arrrayWithObjects:headline, object2, nil];

(The last object passed to this function must always have a nil argument after it.)

Happy coding!

huntaub
thanks for replying em trying to implement your code...Thanks
Nauman.Khattak
its not working brother
Nauman.Khattak
What is it telling you?
huntaub
The correct code is NSArray *theArray = [headline componentsSeparatedByString:@","];
Nauman.Khattak
haha. Well, that doesn't have anything to do with your question. You didn't say that you were trying to split the string or even that the string was separated by commas. You merely asked how to store a NSString in a NSArray.
huntaub