Split one string into different strings

后端 未结 5 588
不知归路
不知归路 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:52

    NSMutableArray *strings = [[@"011597464952,01521545545,454545474,454545444|Hello this is were the message is." componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@",|"]] mutableCopy];
    
    NString *message = [[strings lastObject] copy];
    [strings removeLastObject];
    
    // strings now contains just the number strings
    // do what you need to do strings and message
    
    ....
    
    [strings release];
    [message release];
    

提交回复
热议问题