2010-07-03 55 views
-1

我想將nssarray對象保存爲字符串。代碼是提前如何將nssarray對象保存爲字符串

+0

你有沒有想過格式化你的問題,以便他們實際上可讀?有一個「編輯」按鈕... – Eiko 2010-07-03 12:30:22

+0

如果你在採訪中,給了我這樣的代碼格式,我不會僱用你 - 當然格式化代碼就像這是一個惡夢閱讀和調試嗎? – deanWombourne 2010-07-03 12:47:09

+0

@Eiko和院長 這不公平,你給我-1票。我是客觀的新手,其次我的英語不好是因爲我來自巴基斯坦,而我的語言是URDU而不是英語。它傷害了我,知道我很傷心.... – 2010-07-03 14:11:50

回答

2

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]]; 
    } 
} 

感謝我不知道,如果正確地理解問題,但在原則上應該是 可以這樣做:

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