Split one string into different strings

后端 未结 5 596
不知归路
不知归路 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 21:58

    Look at NSString componentsSeparatedByString or one of the similar APIs.

    If this is a known fixed set of results, you can then take the resulting array and use it something like:

    NSString *number1 = [array objectAtIndex:0];    
    NSString *number2 = [array objectAtIndex:1];
    ...
    

    If it is variable, look at the NSArray APIs and the objectEnumerator option.

提交回复
热议问题