美文网首页
字符串拆分成数组,数组组合成字符串

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

作者: 阿弥陀_丸 | 来源:发表于2017-05-10 15:36 被阅读0次

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

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

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

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

//将字符串拆分成数组

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

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

相关文章

网友评论

      本文标题:字符串拆分成数组,数组组合成字符串

      本文链接:https://www.haomeiwen.com/subject/dhrgtxtx.html