Join an Array in Objective-C

后端 未结 3 1137
逝去的感伤
逝去的感伤 2020-12-12 20:18

I\'m looking for a method of turning a NSMutableArray into a string. Is there anything on a par with this Ruby array method?

>> array1 = [1, 2, 3]
>         


        
3条回答
  •  清歌不尽
    2020-12-12 20:47

    NSArray class reference:

    NSArray *pathArray = [NSArray arrayWithObjects:@"here",
        @"be", @"dragons", nil];
    NSLog(@"%@",
        [pathArray componentsJoinedByString:@" "]);
    

提交回复
热议问题