How to split string into substrings on iOS?

后端 未结 3 489
闹比i
闹比i 2020-12-02 09:37

I received an NSString from the server. Now I want to split it into the substring which I need. How to split the string?

For example:

substrin

3条回答
  •  醉酒成梦
    2020-12-02 10:24

    You can also split a string by a substring, using NString's componentsSeparatedByString method.

    Example from documentation:

    NSString *list = @"Norman, Stanley, Fletcher";
    NSArray *listItems = [list componentsSeparatedByString:@", "];
    

提交回复
热议问题