字符串拆分成数组,数组组合成字符串

NSArray* array=@[@"test1",@"test2",@"test3",@"test4",@"test5",@"test6",@"test7"];

//将数组合并成一个字符串

NSString* appendStr=[array componentsJoinedByString:@" "];

NSLog(@"appendStr=%@",appendStr);

//将字符串拆分成数组

NSArray* resolutionArray=[appendStr componentsSeparatedByString:@" "];

NSLog(@"resolutionArray=%@",resolutionArray);

你可能感兴趣的:(字符串拆分成数组,数组组合成字符串)