how can I convert string to an array with separator?

后端 未结 12 1986
故里飘歌
故里飘歌 2020-12-09 07:26

I have a string in the following format

myString = \"cat+dog+cow\"

I need to store each string separated by + in to a array. Eg:



        
12条回答
  •  半阙折子戏
    2020-12-09 07:55

    NSArray *lines = [string componentsSeparatedByString:@"-"];
    

    The first value will be stored in 0th index of lines and second value will be stored in 1th index of lines..

    Why not array?

提交回复
热议问题