如何将一个字符串数组转换成nsarray
1个回答
2016-01-09
展开全部
2
3
4
5
6
7
8
//字符串转变为数组1
NSMutableString * str=[[NSMutableString alloc]initWithFormat:@"1,1,1,1,1,1"];
//字符串转变为数组2
NSMutableArray * arrwww.hbbz08.com ay=[NSMutableArray arrayWithArray:[str componentsSeparatedByString:@","]];
//替换数组中的某个值
[array replaceObjectAtIndex:4 withObject:@"2"];
//把数组转换成字符串
NSString *ns=[array componentsJoinedByString:@","];
3
4
5
6
7
8
//字符串转变为数组1
NSMutableString * str=[[NSMutableString alloc]initWithFormat:@"1,1,1,1,1,1"];
//字符串转变为数组2
NSMutableArray * arrwww.hbbz08.com ay=[NSMutableArray arrayWithArray:[str componentsSeparatedByString:@","]];
//替换数组中的某个值
[array replaceObjectAtIndex:4 withObject:@"2"];
//把数组转换成字符串
NSString *ns=[array componentsJoinedByString:@","];
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询