How to separate string by space using Objective-C?

前端 未结 5 2139
清歌不尽
清歌不尽 2021-01-30 16:16

Assume that I have a String like this:

hello world       this may     have lots   of sp:ace or little      space

I would like to seperate this

5条回答
  •  再見小時候
    2021-01-30 16:55

    NSString * mainString = @"Today is your day";
    NSArray * array = [mainString componentsSeparatedByString:@" "];
    NSLog(@"Expected string is : %@",array);
    

提交回复
热议问题