1.字符串----->数组
var str ="lao-da-de-shou-hu-xing";
arr=str.split("-");//以短线作为分界线
//arr=[lao,da,de,shou,hu,xing]
2.数组------>字符串
var arr=[lao,da,de,shou,hu,xing];
str=arr.join("-");//str ="lao-da-de-shou-hu-xing";
或
for(int i=0;i<arr.length;i++){
str+=arr[i]+"-";//"lao-da-de-shou-hu-xing-"
}
str=str.substring(0,str.length-1);//截取字符串第一个到倒数第二个"lao-da-de-shou-hu-xing"