嗨,我有这个字符串{“数据”:[{“名称”:“Lorena Trujillo”,“id”:“500144123”},{“名称”:“George Arcila”,“id”:“520311359”},{ “名称”:“劳拉维多利亚穆\u00f1oz Rincon”,“id”:“528543677”},{“名称”:“Camilo Andres Santacoloma Mejia”,“id”:“529547832”}],“paging”:{“下一个“: ”https://graph.facebook.com/537223119/friends?access_token=AAAAAAITEghMBAI7cZBdbAHt3ZC24esi4ZA6O6kFdwU1H0ekDmGQGRZCUZAVW3T6W6fzg50jHsdfsdfsfdsfdsfzdixf1RrTFLzV96ZBWXAZDZD&limit=5000&offset=5000&__after_id=1000456456455“}
}
并且您需要提取 [ 和 ] 之间的子字符串我使用下一个代码
NSRange startRange = [strFriends rangeOfString:@"["];
NSRange endRange = [strFriends rangeOfString:@"]"];
NSString *formData = [strFriends substringWithRange:NSMakeRange(startRange.location,endRange.location)];
NSLog(@"this is the data %@",formData);
结果是
[ {“名称”:“Lorena Trujillo”,“id”:“500144123”},{“名称”:“George Arcila”,“id”:“520311359”},{“名称”:“Laura Victoria Mu\u00f1oz Rincon", "id": "528543677" }, { "name": "Camilo Andres Santacoloma Mejia", "id": "529547832" }],"pagin
知道为什么这些最后一个字符会出现,“非常感谢页面