字符串去空返回数组

var index=item.lineName.lastIndexOf(" ");//去空格
var obj=item.lineName.substring(index+1,item.lineName.length);
console.log(obj.split(/-/),'22222')
this.applicantAddress=obj.split(/-/)[0];
this.communityName=obj.split(/-/)[1];

猜你喜欢

转载自www.cnblogs.com/tuziling/p/10741956.html