去除广告信息
var OilPrice = msg.payload[0].split('\n');
// 去除数组中的空元素
var filteredArray = OilPrice.filter(function (element) {
return element !== '';
});
var StateTips = msg.payload[1].split('\n');
var endIndex = StateTips[2].indexOf('。');
var TipsTips = StateTips[2].substring(0, endIndex + 1);
var newmsg = {};
newmsg.price = filteredArray;
newmsg.state = StateTips[1];
newmsg.tips = TipsTips;
return newmsg;
|