一、数组=>字符串
需要将数组元素用某个字符连接成字符串,示例代码如下:
var arr, str; arr = new Array(0,1,2,3,4); str = arr.join("");//str = "01234"
二、字符串=>数组
将字符串按某个字符切割成若干个字符串,并以数组形式返回,示例代码如下:
var str = "i,want,you"var arr= strsplit","
本文共 254 字,大约阅读时间需要 1 分钟。
一、数组=>字符串
需要将数组元素用某个字符连接成字符串,示例代码如下:
var arr, str; arr = new Array(0,1,2,3,4); str = arr.join("");//str = "01234"
二、字符串=>数组
将字符串按某个字符切割成若干个字符串,并以数组形式返回,示例代码如下:
var str = "i,want,you"var arr= strsplit","
转载于:https://www.cnblogs.com/chaoyong/p/8269895.html