2013-05-27 57 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);