我有这个字符串
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">{"IsSuccess":true,"Result":"","Obj":
[{"FACULTY_CODE":1,"FACULTY_DESC":"\u0E1A\u0E23\u0E34\u0E2B\u0E32\u0E23\u0E18\u0E38\u0E23\u0
E01\u0E34\u0E08","FACULTY_DESC_ENG":"Faculty of Business
Administration","FACULTY_CODE_ICL":"00039","FACULTY_GROUP":"1000"},
{"FACULTY_CODE":2,"FACULTY_DESC":"\u0E19\u0E34\u0E15\u0E34\u0E28\u0E32\u0E2A\u0E15\u0E23\u0E
4C","FACULTY_DESC_ENG":"Faculty of Law","FACULTY_CODE_ICL":"00037","FACULTY_GROUP":"0101"},
{"FACULTY_CODE":3,"FACULTY_DESC":"\u0E28\u0E34\u0E25\u0E1B\u0E28\u0E32\u0E2A\u0E15\u0E23\u0E
4C","FACULTY_DESC_ENG":"Faculty of Liberal
Arts","FACULTY_CODE_ICL":"00096","FACULTY_GROUP":"0100"},
{"FACULTY_CODE":4,"FACULTY_DESC":"\u0E27\u0E34\u0E17\u0E22\u0E32\u0E28\u0E32\u0E2A\u0E15\u0E
23\u0E4C\u0E41\u0E25\u0E30\u0E40\u0E17\u0E04\u0E42\u0E19\u0E42\u0E25\u0E22\u0E35","FACULTY_D
ESC_ENG":"Faculty of Science and
Technology","FACULTY_CODE_ICL":"00083","FACULTY_GROUP":"0303"},
{"FACULTY_CODE":5,"FACULTY_DESC":"\u0E23\u0E31\u0E10\u0E28\u0E32\u0E2A\u0E15\u0E23\u0E4C","F
ACULTY_DESC_ENG":"Faculty of Political
Sciences","FACULTY_CODE_ICL":"00068","FACULTY_GROUP":"0101"},
{"FACULTY_CODE":7,"FACULTY_DESC":"\u0E19\u0E34\u0E40\u0E17\u0E28\u0E28\u0E32\u0E2A\u0E15\u0E
23\u0E4C","FACULTY_DESC_ENG":"Faculty of Communication
Arts","FACULTY_CODE_ICL":"00038","FACULTY_GROUP":"0104"},
{"FACULTY_CODE":8,"FACULTY_DESC":"\u0E27\u0E34\u0E17\u0E22\u0E32\u0E25\u0E31\u0E22\u0E19\u0E
32\u0E19\u0E32\u0E0A\u0E32\u0E15\u0E34\u0E14\u0E34\u0E29\u0E22\u0E30\u0E28\u0E23\u0E34\u0E19
","FACULTY_DESC_ENG":"Didyasarin International
College","FACULTY_CODE_ICL":"00137","FACULTY_GROUP":""},
{"FACULTY_CODE":9,"FACULTY_DESC":".","FACULTY_DESC_ENG":"Bachelor of Fine and Applied
Art","FACULTY_CODE_ICL":"","FACULTY_GROUP":""}]}</string>
但我想删除"<?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">"
和"</string>"
我正在使用此代码
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"{.+}" options:0 error:&error];
NSArray *matches = [regex matchesInString:dataString options:0 range:NSMakeRange(0, [dataString length])];
NSLog(@"matches = %@",matches );
for (NSTextCheckingResult *match in matches) {
NSRange matchRange = [match range];
newDataString = [dataString substringWithRange:matchRange];
}
这没用。