0

I want to show the below value on the view it came in string.

Criteria==============(

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

)

Criteria is the string value coming from web service

4

4 回答 4

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
于 2013-05-27T11:31:58.010 回答
1

如果您想将数组转换为字符串,请尝试此代码

NSArray *st=[yourstring componentsSeparatedByString:@","];
于 2013-05-27T11:37:45.877 回答
1

将“”中的项目从字符串添加到数组中使用

NSString *str = @" 'Communication skills','Willingness to work the process'";
NSArray * arr = [str componentsSeparatedByString:@","];
NSLog(@"%@",arr);
于 2013-05-27T11:37:49.153 回答
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"];
于 2013-05-27T11:43:49.787 回答