NSString to NSArray

前端 未结 7 1084
天命终不由人
天命终不由人 2020-11-30 13:43

I want to split an NSString into an NSArray. For example, given:

NSString *myString=@\"ABCDEF\";

I want an

相关标签:
7条回答
  • 2020-11-30 14:38

    Conversion

    NSString * string = @"A B C D E F";
    NSArray * array = [string componentsSeparatedByString:@" "];
    //Notice that in this case I separated the objects by a space because that's the way they are separated in the string
    

    Logging

    NSLog(@"%@", array);
    

    Console

    This is what the console returned

    0 讨论(0)
提交回复
热议问题