一、数组=>字符串
需要将数组元素用某个字符连接成字符串,示例代码如下:
var arr, str;
arr = new Array(0,1,2,3,4);
str = arr.join("");//str = "01234"
二、字符串=>数组
将字符串按某个字符切割成若干个字符串,并以数组形式返回,示例代码如下:
var str = "i,want,you";
var arr= str.split(",");//arr = array(i,want,you)
标签:代码 pos style mil ons class 组元 body post
一、数组=>字符串
需要将数组元素用某个字符连接成字符串,示例代码如下:
var arr, str;
arr = new Array(0,1,2,3,4);
str = arr.join("");//str = "01234"
二、字符串=>数组
将字符串按某个字符切割成若干个字符串,并以数组形式返回,示例代码如下:
var str = "i,want,you";
var arr= str.split(",");//arr = array(i,want,you)
标签:代码 pos style mil ons class 组元 body post
原文地址:https://www.cnblogs.com/chaoyong/p/8269895.html