我想在它的字符串中顯示下面的值。字符串到數組
標準==============(
"Communication skills",
"Open to following directions",
"Prepared for your case",
"Ability to obtain resolution",
"Willingness to work the process"
)
標準是從Web服務
我想在它的字符串中顯示下面的值。字符串到數組
標準==============(
"Communication skills",
"Open to following directions",
"Prepared for your case",
"Ability to obtain resolution",
"Willingness to work the process"
)
標準是從Web服務
嘗試使用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"];
來嘗試這樣,如果字符串值您的字符串是
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
@Verma:檢查第二行。 – Balu
,如果你想轉換陣列串試試這個代碼
NSArray *st=[yourstring componentsSeparatedByString:@","];
從字符串添加在「」項目到數組使用
NSString *str = @" 'Communication skills','Willingness to work the process'";
NSArray * arr = [str componentsSeparatedByString:@","];
NSLog(@"%@",arr);
u能請詳細說明你的問題稍微彌補理解更好地爲他人回答你的問題。 –
我只想在視圖上顯示這些標準值... – Verma
哪些視圖...? – Balu