xcode将NSString拆分为其他NSStrings

前端之家收集整理的这篇文章主要介绍了xcode将NSString拆分为其他NSStrings前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
{"Title":"Chatroom","Year":"2010","Rated":"R","Released":"11 Aug 2010","Genre":"Drama,Thriller","Director":"Hideo Nakata","Writer":"Enda Walsh,Enda Walsh","Actors":"Aaron Johnson,Imogen Poots,Matthew Beard,Hannah Murray","Plot":"A group of teenagers encourage each other's bad behavior.","Poster":"http://ia.media-imdb.com/images/M/MV5BMjE0MjM5MDM2MF5BMl5BanBnXkFtZTcwMzg1MzY0Mw@@._V1._SX320.jpg","Runtime":"1 hr 37 mins","Rating":"5.3","Votes":"1000","ID":"tt1319704","Response":"True"}

我用nsstring得到这个数据,我的问题是如何分割数据,分离到另一个nsstrings,但我想做逗号这么多nsstrings

解决方法

使用以下内容
NSString *str; //Pass your string to str
NSArray *array = [str componentsSeparatedByString:@","];

for(int i = 0; i < [array count]; i++) {
  // Here just take strings one by one
}

猜你在找的iOS相关文章