Split NSString multiple times on the same separator

前端 未结 2 1186
借酒劲吻你
借酒劲吻你 2020-12-03 00:22

I am currently receiving a string like this:

@\"Sam|26,Hannah|22,Adam|30,Carlie|32,Jan|54\"

And I am splitting it like this:



        
2条回答
  •  感情败类
    2020-12-03 00:51

    The following line...

    testArray2 = [s componentsSeparatedByString:@"|"];
    

    will cause the array to now contain 3 items, instead of 2..... no need to split again!

提交回复
热议问题