美文网首页
字符串与数组相互转化

字符串与数组相互转化

作者: jazzfly | 来源:发表于2018-10-24 10:31 被阅读0次

    NSArray * ary = @[@1,@3];
    1、先把数组转换成字符串

    NSString *string = [ary componentsJoinedByString:@","];//,为分隔符

    2、再把字符串转换成数组,即可把整形数组转换成字符串数组

    ary = [string componentsSeparatedByString:@","];

    相关文章

      网友评论

          本文标题:字符串与数组相互转化

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