Comma-separated string to NSArray in Objective-C

前端 未结 2 969
误落风尘
误落风尘 2020-12-08 06:32

So I have no experience with arrays... But I need to use one to populate a UIPickerView. I am obtaining a list of objects via HTTP (NSURLConnection). This works fine. Curren

2条回答
  •  爱一瞬间的悲伤
    2020-12-08 07:07

    Assuming there's no worry about escaping/unescaping commas contained within the strings, it should be this simple:

    NSArray *items = [theString componentsSeparatedByString:@","];
    

提交回复
热议问题