取开始日期和字符串

//Script here
//result = result.replace("var allSubject = ","");
//var cc = result.indexOf(';');
//var listData = result.substr(0,cc);
var allSubject = null;
var cc = result.indexOf(';');
var result = result.substr(0,cc+1);
var subname_list = [];
eval(result);
//var listData = JSON.stringify(allSubject);

var tmp = [];
for (var i in allSubject){
var row = allSubject[i];
var hotFundYield = row['hotFundYield'];
var hotFundCode = null;
var hotFundSname = null;
var hotFundUnitNetChngPctTyear = null;
if (hotFundYield)
{
hotFundCode=hotFundYield.fundCode;
hotFundSname=hotFundYield.fundSName;
hotFundUnitNetChngPctTyear=hotFundYield.unit_net_chng_pct_tyear;
}else{
}
tmp.push({
'subName':row['subName'],
'unitNetChngPct1Week':row['unit_net_chng_pct_1_week'],
'unitNetChngPct1Mon':row['unit_net_chng_pct_1_mon'],
'unitNetChngPctTYear':row['unit_net_chng_pct_tyear'],
'unitNetChngPct1Year':row['unit_net_chng_pct_1_year'],
'hotFundCode':hotFundCode,
'hotFundSname':hotFundSname,
'hotFundUnitNetChngPctTYear':hotFundUnitNetChngPctTyear
});
};
tmp.sort(function(a,b){
return b.unitNetChngPct1Week-a.unitNetChngPct1Week;
});
var subname_list = [];
for (var i in tmp){
subname_list.push(tmp[i].subName);
if (subname_list.length>=3){
break;
}
}
subname_list = subname_list.join(",");
subname_list=','+subname_list+',';

var listData = JSON.stringify(tmp);

原文地址:https://www.cnblogs.com/gina11/p/13952520.html