split()用法

split();字符串分割成字符串的方法

var str = abc|123fgh;
str.split("|");
$("#a").text(str[0]); //值为:abc
$("#b).text(str[1]); //值为:123fgh


**********************************************


var newPrice =  30.08|[4S店]保利汽车上海有限公司;
//取出来30.08的方法
newPrice.split("|")[0] ; //取出来30.08
newPrice.split("|",1);   //取出来30.08

猜你喜欢

转载自blog.csdn.net/yijiupingfan0914/article/details/79971755