如何将nsarray对象保存到字符串中

时间:2010-07-03 12:19:53

标签: iphone objective-c cocoa-touch

我想将nssarray对象保存到字符串中。代码是

for (NSMutableDictionary *dictionary in blogEntries)
{ 
    NSArray *titlearray = [dictionary objectForKey:@"title"];

    // know i want to store the object in titlearray into string how shoud i
    nsstring *STemp=? how should i write
    NSRange titleResultsRange=[sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch];

    if(titleResultsRange.length>0)
    {
        NSDictionary *titlearrayDic=[NSDictionary  dictionaryWithObject:titlearray forKey:@"title"];
        [storeAll addEntriesFromDictionary:titlearrayDic];
        [listOfItems addObject:[storeAll copy]];
    }
}

提前致谢

1 个答案:

答案 0 :(得分:2)

我不确定是否正确理解了这个问题,但原则上它应该是 可以这样做:

NSMutableString sb = [[NSMutableString alloc] init];
for (NSString* word in titlearray)
  [sb appendWithFormat:word];