2013-05-27 95 views
0

我想在它的字符串中顯示下面的值。字符串到數組

標準==============(

"Communication skills", 
"Open to following directions", 
"Prepared for your case", 
"Ability to obtain resolution", 
"Willingness to work the process" 

標準是從Web服務

+0

u能請詳細說明你的問題稍微彌補理解更好地爲他人回答你的問題。 –

+0

我只想在視圖上顯示這些標準值... – Verma

+0

哪些視圖...? – Balu

回答

0

嘗試使用SBJson庫來解析JSON響應

#import "SBJson.h" 

NSString * criteria = @"Criteria:("Communication skills","Open to following directions","Prepared for your case","Ability to obtain resolution","Willingness to work the process")";   

//criteria is your json response or whatever else is your response. 

SBJsonParser *jsonParser = [SBJsonParser new]; 
NSDictionary *jsonData = (NSDictionary *) [jsonParser objectWithString:criteria error:nil]; 

NSArray *criteriaAry = [[NSArray alloc]init]; 
criteriaAry= [jsonData objectForKey:@"Criteria"]; 
2

來嘗試這樣,如果字符串值您的字符串是

criteria=(
"Communication skills", 
"Open to following directions", 
"Prepared for your case", 
"Ability to obtain resolution", 
"Willingness to work the process" 
) 
then try like this, 

criteria=[criteria stringByReplacingOccurrencesOfString:@"\"" withString:@""]; 

NSArray *resultArray=[criteria componentsSeparatedByString:@","];//String to Atrray 
+0

@Verma:檢查第二行。 – Balu

2

,如果你想轉換陣列串試試這個代碼

NSArray *st=[yourstring componentsSeparatedByString:@","]; 
1

從字符串添加在「」項目到數組使用

NSString *str = @" 'Communication skills','Willingness to work the process'"; 
NSArray * arr = [str componentsSeparatedByString:@","]; 
NSLog(@"%@",arr);