图片数组的互相转换

来源:互联网 发布:淘宝大c香港站货源正吗 编辑:程序博客网 时间:2024/04/29 17:09
//字符串转变为数组1
NSMutableString* str=[[NSMutableStringalloc]initWithFormat:@"1,1,1,1,1,1"];
//字符串转变为数组2
NSMutableArray* array=[NSMutableArrayarrayWithArray:[str   componentsSeparatedByString:@","]];
//替换数组中的某个值
[array replaceObjectAtIndex:4 withObject:@"2"];
//把数组转换成字符串
NSString*ns=[array componentsJoinedByString:@","];
0 0