iOS把数组转化成字符串 字符串转化为数组 数组元素替换

2015-05-08 0 363
iOS把数组转化成字符串    字符串转化为数组  数组元素替换
            //字符串转变为数组1
            NSMutableString * str=[[NSMutableString alloc]initWithFormat:@"1,1,1,1,1,1"];
            //字符串转变为数组2
            NSMutableArray * array=[NSMutableArray arrayWithArray:[str   componentsSeparatedByString:@","]];
            //替换数组中的某个值
            [array replaceObjectAtIndex:4 withObject:@"2"];
            //把数组转换成字符串
            NSString *ns=[array componentsJoinedByString:@","];

遇见资源网 objective-c iOS把数组转化成字符串 字符串转化为数组 数组元素替换 http://www.ox520.com/16624.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务