Split one string into different strings

后端 未结 5 582
不知归路
不知归路 2020-12-15 21:06

i have the text in a string as shown below

011597464952,01521545545,454545474,454545444|Hello this is were the message is.

Basically i woul

5条回答
  •  再見小時候
    2020-12-15 22:04

    does objective-c have strtok()?

    The strtok function splits a string into substrings based on a set of delimiters. Each subsequent call gives the next substring.

    substr = strtok(original, ",|");
    while (substr!=NULL)
    {
       output[i++]=substr;
       substr=strtok(NULL, ",|")
    }
    

提交回复
热议问题